2014-07-06 1 views
0

개체가 끝점에 머물도록 최종 값을 설정하려는 명시적인 애니메이션이 있습니다. 그러나 지연된 애니메이션에서이를 어떻게 달성 할 수 있습니까? 코드는 다음과 같습니다.명시적인 CA 애니메이션 지연의 최종 값을 설정하는 방법

CAKeyframeAnimation *moveAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; 
    moveAnimation.duration = 0.3; 
    moveAnimation.cumulative = YES; 
    moveAnimation.repeatCount = 1; 

    // Bounce 
    [moveAnimation setValues:[NSArray arrayWithObjects: 
         [NSValue valueWithCGPoint:[self getCoordinatePointForAnimationWithRadius:0 withIndex:i]], 
         [NSValue valueWithCGPoint:[self getCoordinatePointForAnimationWithRadius:radius + 10 withIndex:i]], 
         [NSValue valueWithCGPoint:[self getCoordinatePointForAnimationWithRadius:radius - 5 withIndex:i]], 
         [NSValue valueWithCGPoint:[self getCoordinatePointForAnimationWithRadius:radius withIndex:i]], nil]]; 

    [moveAnimation setKeyTimes:[NSArray arrayWithObjects: 
          [NSNumber numberWithFloat:0], 
          [NSNumber numberWithFloat:0.5], 
          [NSNumber numberWithFloat:0.75], 
          [NSNumber numberWithFloat:1.0], nil]]; 

    [moveAnimation setTimingFunctions:[NSArray arrayWithObjects: 
             [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut], nil]]; 



    moveAnimation.beginTime = CACurrentMediaTime() + 1 + (0.1 * i); 


    [layer addAnimation:opacityAnimation forKey:@"opacityAnimationUp"]; 
    [layer addAnimation:moveAnimation forKey:@"moveAnimationUp"]; 

// That's not working correctly because of the delay 
    [layer setOpacity:1.0]; 
    [layer setPosition:[self getCoordinatePointForAnimationWithRadius:radius withIndex:i]]; 

고마워요! 독일에서

안부, 크리스

답변

2

그것은 거꾸로 모드를 채우기 실종 유일한 것 같습니다. 실제 애니메이션이 지연 되더라도 애니메이션이 추가되는 즉시 첫 번째 값이 표시됩니다.

+0

와우 제작되었습니다. 고마워 데이빗 (+1) –