Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeat or Loop animations #29

Open
josecostamartins opened this issue Nov 13, 2014 · 1 comment
Open

Repeat or Loop animations #29

josecostamartins opened this issue Nov 13, 2014 · 1 comment

Comments

@josecostamartins
Copy link

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

@josecostamartins
Copy link
Author

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];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant