CAScrollLayer没有处理视频

时间:2016-01-21 07:51:33

标签: ios objective-c animation editing

我正试图在CAScrollLayer的帮助下在视频上创建图像动画我可以在CAScrollLayer上添加图像但是在播放视频时它不会滚动任何帮助都会在下面显示我的代码我到目前为止已经尝试过了。

   CALayer *layer;

   // self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
   scrollLayer = [CAScrollLayer layer];
   scrollLayer.backgroundColor =  [[UIColor blackColor] CGColor];
   scrollLayer.bounds = parentLayer.bounds;
   scrollLayer.contentsRect = CGRectMake(0, 0, scrollLayer.bounds.size.width*images.count, scrollLayer.bounds.size.height);
   scrollLayer.borderWidth = 2.5;
   scrollLayer.borderColor = [[UIColor redColor] CGColor];
   scrollLayer.position = CGPointMake(self.view.center.x, self.view.center.y - 20);
   scrollLayer.scrollMode = kCAScrollHorizontally;
   scrollLayer.speed = 2.0;
   //  [self.view.layer addSublayer:scrollLayer];

   [parentLayer insertSublayer:scrollLayer atIndex:0];

   for(int i=0; i<[images count]; i++) {
      UIImage *image = [images objectAtIndex:i];
      layer = [CALayer layer];
      layer.backgroundColor = [[UIColor blackColor] CGColor];
      layer.bounds = CGRectMake(0, 0, 300, 300);
      layer.contents = (id)[image CGImage];
      layer.position = CGPointMake(layer.bounds.size.width * i, self.view.center.y);

      // scrollLayer.speed = 2.0;

      [scrollLayer addSublayer:layer];
   }

   [parentLayer addSublayer:scrollLayer];
   [self performSelector:@selector(scrollPoint) withObject:nil   afterDelay:2.0];
   compostion.animationTool = [AVVideoCompositionCoreAnimationTool videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];

谢谢。

0 个答案:

没有答案