0

如何为图像设置动画,使其看起来像是向用户走来。例如:在天空中移动

4

2 回答 2

1

请查看此解决方案

-(IBAction)showSignInView:(id)sender{
    signInView.hidden = NO;
    [self initialDelayEnded:Your View ];
}
-(void)initialDelayEnded:(UIView *)view {
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.3, 0.3);
    view.alpha = 1.0;
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/1.5];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce1AnimationStopped:)];
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
    [UIView commitAnimations];
}

- (void)bounce1AnimationStopped:(UIView *)view {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/2];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(bounce2AnimationStopped:)];
    view.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.0, 1.0);
    [UIView commitAnimations];
}

- (void)bounce2AnimationStopped:(UIView *)view {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:kTransitionDuration/2];
    view.transform = CGAffineTransformIdentity;
    [UIView commitAnimations];
}
于 2012-05-30T11:09:33.237 回答
0

使用淡入和淡出动画图像 -

- (IBAction)showHideView:(id)sender
{
// Fade out the view right away
[UIView animateWithDuration:1.0
    delay: 0.0
    options: UIViewAnimationOptionCurveEaseIn
    animations:^{
         imageView.alpha = 0.0;
    }
    completion:^(BOOL finished){
        // Wait one second and then fade in the view
        [UIView animateWithDuration:1.0
             delay: 1.0
             options:UIViewAnimationOptionCurveEaseOut
             animations:^{
                imageView.alpha = 1.0;
             }
             completion:nil];
    }];
}

请参阅 - http://developer.apple.com/library/ios/#documentation/windowsviews/conceptual/viewpg_iphoneos/animatingviews/animatingviews.html

于 2012-05-30T10:58:08.797 回答