diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 92 |
1 files changed, 44 insertions, 48 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index bb1d5a1f..fddfd170 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -357,10 +357,10 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
357 | }, | 357 | }, |
358 | 358 | ||
359 | didDraw:{ | 359 | didDraw:{ |
360 | value:function(){ | 360 | value:function () { |
361 | if(this._openDocRedrawCheck){ | 361 | if (this._openDocRedrawCheck) { |
362 | this.retrieveStoredTweens(); | 362 | this.retrieveStoredTweens(); |
363 | this._openDocRedrawCheck=false; | 363 | this._openDocRedrawCheck = false; |
364 | } | 364 | } |
365 | } | 365 | } |
366 | }, | 366 | }, |
@@ -453,55 +453,51 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
453 | }, | 453 | }, |
454 | 454 | ||
455 | retrieveStoredTweens:{ | 455 | retrieveStoredTweens:{ |
456 | value:function(){ | 456 | value:function () { |
457 | var percentValue,fraction,splitValue,i=0,k=0 | 457 | var percentValue, fraction, splitValue, i = 0; |
458 | while(this.application.ninja.timeline.arrLayers[k]){ | 458 | |
459 | this.animatedElement = this.application.ninja.timeline.arrLayers[k].elementsList[0]; | 459 | this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0]; |
460 | this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement,"-webkit-animation-name"); | 460 | this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); |
461 | this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement,"-webkit-animation-duration"); | 461 | this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); |
462 | this.trackDuration = this.animationDuration.split("s"); | 462 | this.trackDuration = this.animationDuration.split("s"); |
463 | this.currentMilliSec =this.trackDuration[0]*1000; | 463 | this.currentMilliSec = this.trackDuration[0] * 1000; |
464 | this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
465 | this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; | ||
466 | this.nextKeyframe = 0; | ||
467 | |||
468 | this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); | ||
469 | while (this.currentKeyframeRule[i]) { | ||
470 | var newTween = {}; | ||
471 | if (this.currentKeyframeRule[i].keyText === "0%") { | ||
472 | newTween.spanWidth = 0; | ||
473 | newTween.keyFramePosition = 0; | ||
474 | newTween.keyFrameMillisec = 0; | ||
475 | newTween.tweenID = 0; | ||
476 | newTween.spanPosition = 0; | ||
477 | this.tweens.push(newTween); | ||
478 | |||
479 | } | ||
480 | else { | ||
481 | percentValue = this.currentKeyframeRule[i].keyText; | ||
482 | splitValue = percentValue.split("%"); | ||
483 | fraction = splitValue[0] / 100; | ||
484 | this.currentMilliSec = fraction * this.trackDuration[0] * 1000; | ||
464 | this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | 485 | this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); |
465 | this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; | 486 | this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; |
466 | this.nextKeyframe=0; | 487 | newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; |
467 | 488 | newTween.keyFramePosition = this.clickPos; | |
468 | this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName , this.application.ninja.currentDocument._document); | 489 | newTween.keyFrameMillisec = this.currentMilliSec; |
469 | while(this.currentKeyframeRule[i]){ | 490 | newTween.tweenID = this.nextKeyframe; |
470 | var newTween = {}; | 491 | newTween.spanPosition = this.clickPos - newTween.spanWidth; |
471 | if( this.currentKeyframeRule[i].keyText==="0%"){ | 492 | this.tweens.push(newTween); |
472 | newTween.spanWidth = 0; | ||
473 | newTween.keyFramePosition = 0; | ||
474 | newTween.keyFrameMillisec = 0; | ||
475 | newTween.tweenID = 0; | ||
476 | newTween.spanPosition = 0; | ||
477 | this.tweens.push(newTween); | ||
478 | |||
479 | } | ||
480 | else{ | ||
481 | percentValue=this.currentKeyframeRule[i].keyText; | ||
482 | splitValue=percentValue.split("%"); | ||
483 | fraction=splitValue[0]/100; | ||
484 | this.currentMilliSec =fraction*this.trackDuration[0]*1000; | ||
485 | this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
486 | this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; | ||
487 | newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; | ||
488 | newTween.keyFramePosition = this.clickPos; | ||
489 | newTween.keyFrameMillisec = this.currentMilliSec; | ||
490 | newTween.tweenID = this.nextKeyframe; | ||
491 | newTween.spanPosition = this.clickPos - newTween.spanWidth; | ||
492 | this.tweens.push(newTween); | ||
493 | |||
494 | |||
495 | } | ||
496 | i++; | ||
497 | this.nextKeyframe+=1; | ||
498 | } | ||
499 | k++; | ||
500 | } | ||
501 | 493 | ||
502 | 494 | ||
495 | } | ||
496 | i++; | ||
497 | this.nextKeyframe += 1; | ||
503 | } | 498 | } |
504 | }, | 499 | } |
500 | }, | ||
505 | 501 | ||
506 | addAnimationRuleToElement:{ | 502 | addAnimationRuleToElement:{ |
507 | value:function (tweenEvent) { | 503 | value:function (tweenEvent) { |