Skip to content

Commit f16ffdc

Browse files
committed
1 parent 5ecf3fc commit f16ffdc

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ - (CCBSequence*)sequenceFromSequenceId:(int)seqId {
171171
- (CCActionInterval*)actionFromKeyframe0:(CCBKeyframe*)kf0 andKeyframe1:(CCBKeyframe*)kf1 propertyName:(NSString*)name node:(CCNode*)node {
172172
float duration = kf1.time - kf0.time;
173173

174+
if(kf0.easingType==kCCBKeyframeEasingInstant) {
175+
duration = 0;
176+
}
177+
174178
if ([name isEqualToString:@"rotation"]) {
175179
return [CCActionRotateTo actionWithDuration:duration angle:[kf1.value floatValue] simple:YES];
176180
} else if ([name isEqualToString:@"position"]) {
@@ -855,14 +859,15 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
855859

856860
CCActionInterval* action = [self actionFromKeyframe0:startKF andKeyframe1:endKF propertyName:seqProp.name node:node];
857861

858-
// Create delay to fix instant easing on non instant actions
859-
if(startKF.easingType==kCCBKeyframeEasingInstant &&
860-
![seqProp.name isEqualToString:@"spriteFrame"] &&
861-
![seqProp.name isEqualToString:@"visible"]) {
862-
[actions addObject:[CCActionDelay actionWithDuration:action.duration]];
863-
}
864-
865862
if (action) {
863+
864+
// Instant
865+
if(startKF.easingType==kCCBKeyframeEasingInstant &&
866+
![seqProp.name isEqualToString:@"spriteFrame"] &&
867+
![seqProp.name isEqualToString:@"visible"]) {
868+
[actions addObject:[CCActionDelay actionWithDuration:action.duration]];
869+
}
870+
866871
// Apply Easing
867872
action = [self easeAction:action easingType:startKF.easingType easingOpt:startKF.easingOpt];
868873
[actions addObject:action];

0 commit comments

Comments
 (0)