-(void)animation_left{
[UIView animateWithDuration:10.0 delay:1.0 options:UIViewAnimationOptionAllowUserInteraction animations:^(void){
[self.first_fish setFrame:CGRectMake(-70, self.first_fish.frame.origin.y, self.first_fish.frame.size
.width, self.first_fish.frame.size.height)];
[self.first_fish setTransform:CGAffineTransformMakeScale(-1, 1)]; // flip horizontally
self.first_fish.animati arrayWithObjects:[UIImage imageNamed:@"fish_right1"],
[UIImage imageNamed:@"fish_right2"], [UIImage imageNamed:@"fish_right3"], [UIImage imageNamed:@"fish_right4"], [UIImage imageNamed:@"fish_right14"], [UIImage imageNamed:@"fish_right15"], [UIImage imageNamed:@"fish_right20"], nil];
self.first_fish.animati
[self.first_fish startAnimating];
}completion:^(BOOL finished){
[self.first_fish setTransform:CGAffineTransformIdentity];
[self.first_fish setImage:[UIImage imageNamed:@"fish_right1"]];
[self animation_right];
}];
}
-(void)animation_right{
[UIView animateWithDuration:10.0 delay:1.0 options:UIViewAnimationOptionAllowUserInteraction animations:^(void){
[self.first_fish setFrame:CGRectMake(330, self.first_fish.frame.origin.y, self.first_fish.frame.size
.width, self.first_fish.frame.size.height)];
self.first_fish.animati arrayWithObjects:[UIImage imageNamed:@"fish_right1"],
[UIImage imageNamed:@"fish_right2"], [UIImage imageNamed:@"fish_right3"], [UIImage imageNamed:@"fish_right4"], [UIImage imageNamed:@"fish_right14"], [UIImage imageNamed:@"fish_right15"], [UIImage imageNamed:@"fish_right20"], nil];
self.first_fish.animati
[self.first_fish startAnimating];
}completion:^(BOOL finished){
[self.first_fish setTransform:CGAffineTransformMakeScale(-1, 1)];
[self.first_fish setImage:[UIImage imageNamed:@"fish_left1.png"]];
[self animation_left];
}];
}Add a code snippet to your website: www.paste.org