aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline
diff options
context:
space:
mode:
authorJonathan Duran2012-02-23 11:05:38 -0800
committerJonathan Duran2012-02-23 11:05:38 -0800
commitd382eca23468b10575ca857a9feb1ede136ab813 (patch)
tree9a298f1263c72ac3f4936017db63d5ec4727c5d4 /js/panels/Timeline
parent7b6f27edb718d381ccec6089a8039ffa0dcb80a2 (diff)
downloadninja-d382eca23468b10575ca857a9feb1ede136ab813.tar.gz
Timeline Track Open doc
Signed-off-by: Kruti Shah <kruti.shah@motorola.com> Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index de2c75c7..40e680de 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -347,6 +347,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
347 if (this._styleCollapser.isCollapsed !== this.isStyleCollapsed) { 347 if (this._styleCollapser.isCollapsed !== this.isStyleCollapsed) {
348 this._styleCollapser.toggle(false); 348 this._styleCollapser.toggle(false);
349 } 349 }
350 this.retrieveStoredTweens();
350 } 351 }
351 }, 352 },
352 353
@@ -437,6 +438,59 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
437 } 438 }
438 }, 439 },
439 440
441 retrieveStoredTweens:{
442 value:function(){
443 var animationDuration,trackDuration,currentMilliSec , currentMillisecPerPixel,clickPos,i=0,k=0;
444 if(this.application.ninja.timeline.currentLayerSelected.element[0]){
445 this.animatedElement = this.application.ninja.timeline.currentLayerSelected.element[0];
446 this.animationName = this.ninjaStylesContoller.getElementStyle(this.animatedElement,"-webkit-animation-name");
447 animationDuration = this.ninjaStylesContoller.getElementStyle(this.animatedElement,"-webkit-animation-duration");
448 trackDuration = animationDuration.split("s");
449 currentMilliSec =trackDuration[0]*1000;
450 currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
451 clickPos = currentMilliSec / currentMillisecPerPixel;
452
453 this.currentKeyframeRule = this.ninjaStylesContoller.getAnimationRuleWithName(this.animationName , this.application.ninja.currentDocument._document);
454
455 var newTween = {};
456 if( this.currentKeyframeRule[i].keyText==="0%"){
457 newTween.spanWidth = 0;
458 newTween.keyFramePosition = 0;
459 newTween.keyFrameMillisec = 0;
460 newTween.keyframeID = i;
461 newTween.spanPosition = 0;
462 this.tweens.push(newTween);
463
464 }else{
465
466 newTween.spanWidth = clickPos - this.tweens[this.tweens.length - 1].keyFramePosition;
467 newTween.keyFramePosition = clickPos;
468 newTween.keyFrameMillisec = currentMilliSec;
469 newTween.keyframeID = i;
470 newTween.spanPosition = clickPos - newTween.spanWidth;
471 this.tweens.push(newTween);
472
473 }
474 this.needsDraw=true;
475 // this.retrieveAnimationRuleToElement();
476 this.i++;
477
478 // this.ninjaStylesContoller.deleteRule(this.currentKeyframeRule);
479
480 }
481
482 }
483 },
484
485 retrieveAnimationRuleToElement:{
486 value:function(){
487 // this.animatedElement = this.tempArray[0];
488 // var initAnimatedProperties = new Array();
489 // initAnimatedProperties["top"] = this.currentKeyframeRule[this.i].style[0];
490 // initAnimatedProperties["left"] = this.currentKeyframeRule[this.i].style[1];
491 }
492 },
493
440 addAnimationRuleToElement:{ 494 addAnimationRuleToElement:{
441 value:function (tweenEvent) { 495 value:function (tweenEvent) {
442 this.tweens[0].tweenedProperties["top"] = this.animatedElement.offsetTop; 496 this.tweens[0].tweenedProperties["top"] = this.animatedElement.offsetTop;