CanvasPod/Canvas

Repeat or Loop animations

josecostamartins opened this issue · 1 comments

Hi guys, is there a way to make the animations repeat itself continuously?

I've figure it out a way to loop animations.

first, i only know how to do it by code. And i'll be using the example from the github readme, here it goes:

#import "Canvas.h"

// we need the animation view to be a property, this way we can access it in other places of the code
//@property (strong, nonatomic) CSAnimationView *animationView;

 _animationView = [[CSAnimationView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
_animationView.backgroundColor = [UIColor whiteColor];

_animationView.duration = 0.5;
_animationView.delay    = 0;
_animationView.type     = CSAnimationTypeMorph;

[self.view addSubview:_animationView];

// Add your subviews into animationView
// [_animationView addSubview:<#(UIView *)#>]

// Kick start the animation immediately
[_animationView startCanvasAnimation];

create a method with the call to animationView StartCanvasAnimation

-(void)animateImage{
        [_animationView startCanvasAnimation];
}

now in the viewDidAppear delegate method do:

-(void)viewDidAppear:(BOOL)animated{
    [NSTimer scheduledTimerWithTimeInterval:1.5 target:self
                                   selector:@selector(animateImage) userInfo:nil repeats:YES];
}