动画图像

时间:2010-04-13 11:55:56

标签: iphone objective-c iphone-sdk-3.0

我正在创建一个游戏,因为我想使用一些动画,但我不熟悉动画。 我想创建一个图像,一旦我点击imageview,图像应该以弹跳的方式进入,好像它是一个球,所以它可以这样做吗?图像是为游戏预定义的。它必须在触摸开始事件发生后,任何人都可以帮助我??? 问候 病毒

1 个答案:

答案 0 :(得分:0)

你可以做点什么

imageview = [[[UIImageView alloc] initWithFrame:CGRectMake(x,y,w,h)]autorelease];
    imageview.image = [[UIImage imageNamed: [NSString stringWithString:name]]autorelease];
    [self.view addSubview:imageview];
    imageview.frame = CGRectMake(imageview.frame.origin.x, (imageview.frame.origin.y), imageview.frame.size.width, imageview.frame.size.height);
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDelegate:self];
    //[UIView setAnimationWillStartSelector:@selector(Transform2)];


    [UIView setAnimationDuration:k_AnimateTime];

    [UIView setAnimationBeginsFromCurrentState:YES];
    //[UIView setAnimationDidStopSelector:@selector(increaseCount)];
    imageview.frame = CGRectMake(imageview.frame.origin.x - Ex, (imageview.frame.origin.y - Ey), imageview.frame.size.width, imageview.frame.size.height);
    [UIView commitAnimations];

这会将您的图像从一个坐标移动到另一个坐标动画...设置适当的坐标使其看起来像弹跳效果......

相关问题