@@ -171,6 +171,10 @@ - (CCBSequence*)sequenceFromSequenceId:(int)seqId {
171
171
- (CCActionInterval*)actionFromKeyframe0 : (CCBKeyframe*)kf0 andKeyframe1 : (CCBKeyframe*)kf1 propertyName : (NSString *)name node : (CCNode*)node {
172
172
float duration = kf1.time - kf0.time ;
173
173
174
+ if (kf0.easingType ==kCCBKeyframeEasingInstant ) {
175
+ duration = 0 ;
176
+ }
177
+
174
178
if ([name isEqualToString: @" rotation" ]) {
175
179
return [CCActionRotateTo actionWithDuration: duration angle: [kf1.value floatValue ] simple: YES ];
176
180
} else if ([name isEqualToString: @" position" ]) {
@@ -207,12 +211,12 @@ - (CCActionInterval*)actionFromKeyframe0:(CCBKeyframe*)kf0 andKeyframe1:(CCBKeyf
207
211
return [CCActionTintTo actionWithDuration: duration color: color];
208
212
} else if ([name isEqualToString: @" visible" ]) {
209
213
if ([kf1.value boolValue ]) {
210
- return [CCActionSequence actionOne: [CCActionDelay actionWithDuration: duration] two: [ CCActionShow action ] ];
214
+ return [CCActionShow action ];
211
215
} else {
212
- return [CCActionSequence actionOne: [CCActionDelay actionWithDuration: duration] two: [ CCActionHide action ] ];
216
+ return [CCActionHide action ];
213
217
}
214
218
} else if ([name isEqualToString: @" spriteFrame" ]) {
215
- return [CCActionSequence actionOne: [CCActionDelay actionWithDuration: duration] two: [ CCActionSpriteFrame actionWithSpriteFrame: kf1.value] ];
219
+ return [CCActionSpriteFrame actionWithSpriteFrame: kf1.value];
216
220
} else {
217
221
CCLOG (@" CCBReader: Failed to create animation for property: %@ " , name);
218
222
}
@@ -356,7 +360,7 @@ - (void)runActionsForNode:(CCNode*)node sequenceProperty:(CCBSequenceProperty*)s
356
360
if (numKeyframes<1 ) return ;
357
361
358
362
// Action Sequence Builder
359
- NSMutableArray * actions = [NSMutableArray array ];
363
+ NSMutableArray * actions = [NSMutableArray array ];
360
364
int endFrame = startFrame+1 ;
361
365
362
366
if (endFrame==numKeyframes || endFrame<0 )
@@ -855,14 +859,13 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
855
859
856
860
CCActionInterval* action = [self actionFromKeyframe0: startKF andKeyframe1: endKF propertyName: seqProp.name node: node];
857
861
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
-
865
862
if (action) {
863
+
864
+ // Instant
865
+ if (startKF.easingType ==kCCBKeyframeEasingInstant ) {
866
+ [actions addObject: [CCActionDelay actionWithDuration: endKF.time-startKF.time]];
867
+ }
868
+
866
869
// Apply Easing
867
870
action = [self easeAction: action easingType: startKF.easingType easingOpt: startKF.easingOpt];
868
871
[actions addObject: action];
0 commit comments