簡體   English   中英

動畫圖像

[英]Animating an Image

我正在創建一個游戲,因為我想使用一些動畫,但是我對動畫並不陌生。 我想創建一個圖像,一旦我單擊圖像視圖,該圖像應該以彈跳的方式出現,就好像它是一個球一樣,有可能這樣做嗎? 該圖像是為游戲預定義的。它必須在觸摸開始事件發生后出現,任何人都可以幫助我嗎??? 視為病毒。

你可以做類似的事情

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

這會將您的圖像從一個共同坐標移動到另一個具有動畫效果的坐標...設置適當的坐標,使其看起來像彈跳效果...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM