2011-08-29 3 views
0

키워드가 루핑 중입니다. 저는 펄스와 같은 애니메이션을위한 두 가지 기능을 가지고 있다고 생각합니다. 이것을 루프로 만드는 가장 좋은 방법입니까?반복 애니메이션을 수행하는 가장 좋은 방법은 무엇입니까?

-(void)animationPart1 { 

    //Do first half of animation here, pulse in, the animation is 0.3 seconds long 
    [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(animationPart2) userInfo:nil repeats:NO]; 

} 

-(void)animationPart2 { 

    //Do second half of animation here, pulse out, the animation is 0.3 seconds long 
    [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(animationPart1) userInfo:nil repeats:NO]; 

} 

저는 애니메이션을 처음 사용합니다.

답변

0

이 방법을 사용하는 경우 "반복"을 "예"로 설정해야하며 그런 다음 재귀 루프를 만들 필요가 없다고 생각합니다.

당신이 정확히 무엇을 시도하는지 알지 못하는 사이에, 나는 다양한 것들을 움직이게하는 많은 다른 방법을 가진 Core Animation의 "CABasicAnimation"과 같은 애니메이션에 접근하는 많은 방법이 있다고 생각한다. 예) :

http://www.cimgf.com/2009/10/20/marching-ants-with-core-animation/

당신이 그런 게임으로 매우 무거운 애니메이션을 수행하는 경우는, 다음적인 Cocos2D를 사용, 그것은 바위.

+0

도움 주셔서 감사합니다. –

관련 문제