2010-04-13 129 views
0

我在創建一個遊戲,因爲我想使用一些動畫,但我是新來的動畫。 我想創建一個圖像,只要我點擊imageview,圖像應該以彈跳的方式進來,就像它是一個球,所以有可能這樣做嗎?該圖像是爲遊戲預定義的,並且它必須在觸摸開始事件發生之後發生,任何人都可以幫助我嗎? 關於 病毒。動畫圖像

+0

答案對此相當涉及。你需要閱讀電腦動畫或遊戲編程。 – 2010-04-13 11:57:51

+1

如果你能想象它,那麼它幾乎可以肯定是編碼,你試過什麼代碼? – amelvin 2010-04-13 11:59:03

+0

我還沒有添加任何動畫代碼,現在我儘快顯示簡單的值,只要我觸摸圖像視圖,但我想要一些不同的圖像動畫。 – 2010-04-13 12:07:00

回答

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

這將您的圖像從一個共同的座標移動到另一個座標動畫...設置適當的座標,使其看起來像彈跳effcet ...

+0

感謝哥們,現在讓我試試這個並回復相同的問題。和謝謝.... – 2010-04-13 13:33:03