Skip to content

Commit d6d306b

Browse files
committed
Merge pull request #950 from jtwigg/v3.2
V3.2 Fix Tweening Unit Test.
2 parents a543437 + 4163159 commit d6d306b

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

cocos2d-ui/CCBReader/CCAnimationManager.m

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ - (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-
178174
if ([name isEqualToString:@"rotation"]) {
179175
return [CCActionRotateTo actionWithDuration:duration angle:[kf1.value floatValue] simple:YES];
180176
} else if ([name isEqualToString:@"position"]) {
@@ -360,7 +356,7 @@ - (void)runActionsForNode:(CCNode*)node sequenceProperty:(CCBSequenceProperty*)s
360356
if(numKeyframes<1) return;
361357

362358
// Action Sequence Builder
363-
NSMutableArray* actions = [NSMutableArray array];
359+
NSMutableArray* actions = [NSMutableArray array];
364360
int endFrame = startFrame+1;
365361

366362
if(endFrame==numKeyframes || endFrame<0)
@@ -469,6 +465,11 @@ - (void)runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuratio
469465
_paused = YES;
470466
[self clearAllActions];
471467

468+
// Set the running scene
469+
_runningSequence = [self sequenceFromSequenceId:seqId];
470+
_runningSequence.time = 0.0f;
471+
_runningSequence.tween = tweenDuration;
472+
472473
[self addSequenceCallBacks:seqId tweenDuration:tweenDuration startTime:0];
473474

474475
// Contains all Sequence Propertys / Keyframe
@@ -510,26 +511,13 @@ - (void)runAnimationsForSequenceId:(int)seqId tweenDuration:(float) tweenDuratio
510511
}
511512
}
512513
}
513-
514-
// Reset nodes that have sequence node properties, build first keyframe action sequence.
515-
for (NSString* propName in seqNodeProps) {
516-
CCBSequenceProperty* seqProp = [seqNodeProps objectForKey:propName];
517-
[seqNodePropNames addObject:propName];
518-
519-
// Reset Node State to First KeyFrame
520-
[self setKeyFrameForNode:node sequenceProperty:seqProp tweenDuration:tweenDuration keyFrame:0];
521-
522-
}
514+
523515
}
524516

525517

526518
}
527519

528-
// Set the running scene
529-
_runningSequence = [self sequenceFromSequenceId:seqId];
530-
_runningSequence.time = 0.0f;
531-
532-
_paused = NO;
520+
_paused = NO;
533521
}
534522

535523
- (void)runAnimationsForSequenceNamed:(NSString*)name tweenDuration:(float)tweenDuration {
@@ -864,8 +852,8 @@ - (CCActionSequence*)createActionForNode:(CCNode*)node sequenceProperty:(CCBSequ
864852
// Instant
865853
if(startKF.easingType==kCCBKeyframeEasingInstant) {
866854
[actions addObject:[CCActionDelay actionWithDuration:endKF.time-startKF.time]];
867-
}
868-
855+
}
856+
869857
// Apply Easing
870858
action = [self easeAction:action easingType:startKF.easingType easingOpt:startKF.easingOpt];
871859
[actions addObject:action];

0 commit comments

Comments
 (0)