Animating images using CAAnimation

前端 未结 1 2085
时光说笑
时光说笑 2021-02-11 02:37

Is it possible to implement animating sequence of images using CAAnimation? And i dont want to use UIImageView...

I need Something similar to UIImageView where we can

1条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-11 02:50

    CAKeyframeAnimation *animationSequence = [CAKeyframeAnimation animationWithKeyPath: @"contents"];
    animationSequence.calculationMode = kCAAnimationLinear;
    animationSequence.autoreverses = YES;
    animationSequence.duration = kDefaultAnimationDuration;
    animationSequence.repeatCount = HUGE_VALF;
    
    NSMutableArray *animationSequenceArray = [[NSMutableArray alloc] init];
    for (UIImage *image in self.animationImages) 
    {
        [animationSequenceArray addObject:(id)image.CGImage];
    }
    animationSequence.values = animationSequenceArray;
    [animationSequenceArray release];
    [self.layer addAnimation:animationSequence forKey:@"contents"];
    

    0 讨论(0)
提交回复
热议问题