Skip to content

Commit a6ce1e3

Browse files
committed
Improve Instant Easing
1 parent f16ffdc commit a6ce1e3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,12 @@ - (CCActionInterval*)actionFromKeyframe0:(CCBKeyframe*)kf0 andKeyframe1:(CCBKeyf
211211
return [CCActionTintTo actionWithDuration:duration color:color];
212212
} else if ([name isEqualToString:@"visible"]) {
213213
if ([kf1.value boolValue]) {
214-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionShow action]];
214+
return [CCActionShow action];
215215
} else {
216-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionHide action]];
216+
return [CCActionHide action];
217217
}
218218
} else if ([name isEqualToString:@"spriteFrame"]) {
219-
return [CCActionSequence actionOne:[CCActionDelay actionWithDuration:duration] two:[CCActionSpriteFrame actionWithSpriteFrame:kf1.value]];
219+
return [CCActionSpriteFrame actionWithSpriteFrame:kf1.value];
220220
} else {
221221
CCLOG(@"CCBReader: Failed to create animation for property: %@", name);
222222
}
@@ -360,7 +360,7 @@ - (void)runActionsForNode:(CCNode*)node sequenceProperty:(CCBSequenceProperty*)s
360360
if(numKeyframes<1) return;
361361

362362
// Action Sequence Builder
363-
NSMutableArray* actions = [NSMutableArray array];
363+
NSMutableArray* actions = [NSMutableArray array];
364364
int endFrame = startFrame+1;
365365

366366
if(endFrame==numKeyframes || endFrame<0)
@@ -862,10 +862,8 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
862862
if (action) {
863863

864864
// Instant
865-
if(startKF.easingType==kCCBKeyframeEasingInstant &&
866-
![seqProp.name isEqualToString:@"spriteFrame"] &&
867-
![seqProp.name isEqualToString:@"visible"]) {
868-
[actions addObject:[CCActionDelay actionWithDuration:action.duration]];
865+
if(startKF.easingType==kCCBKeyframeEasingInstant) {
866+
[actions addObject:[CCActionDelay actionWithDuration:endKF.time-startKF.time]];
869867
}
870868

871869
// Apply Easing

0 commit comments

Comments
 (0)