aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js45
1 files changed, 21 insertions, 24 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index bf97c0fd..a2aaa550 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -459,7 +459,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
459 459
460 retrieveStoredTweens:{ 460 retrieveStoredTweens:{
461 value:function () { 461 value:function () {
462 var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0; 462 var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute
463 var animationTiming,trackTiming,currentMilliSec,currentMilliSecPerPixel,clickPosition,i = 0;
463 464
464 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 465 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
465 this.application.ninja.timeline.arrLayers[selectedIndex].created=true; 466 this.application.ninja.timeline.arrLayers[selectedIndex].created=true;
@@ -467,23 +468,23 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
467 if(this.animatedElement!==undefined){ 468 if(this.animatedElement!==undefined){
468 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); 469 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name");
469 if(this.animationName){ 470 if(this.animationName){
470 this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); 471 animationTiming = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration");
471 this.trackDuration = this.animationDuration.split("s"); 472 trackTiming = animationTiming.split("s");
472 this.currentMilliSec = this.trackDuration[0] * 1000; 473 currentMilliSec = trackTiming[0] * 1000;
473 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 474 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
474 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 475 clickPosition = currentMilliSec / currentMilliSecPerPixel;
475 this.nextKeyframe = 0; 476 this.nextKeyframe = 0;
476 477
477 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); 478 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
478 while (this.currentKeyframeRule[i]) { 479 for (i =0; this.currentKeyframeRule[i] ;i++) {
479 var newTween = {}; 480 var newTween = {};
480 481
481 offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); 482 offsetAttribute = this.currentKeyframeRule[i].cssText.split(" ");
482 topOffSetAttribute = offsetAttribute[3].split("px"); 483 topOffSetAttribute = offsetAttribute[3].split("px");
483 leftOffsetAttribute = offsetAttribute[5].split("px"); 484 leftOffsetAttribute = offsetAttribute[5].split("px");
484 485
485 parseInt(topOffSetAttribute[0]); 486 var tempTopOffset = parseInt(topOffSetAttribute[0]);
486 parseInt(leftOffsetAttribute[0]); 487 var tempLeftOffset =parseInt(leftOffsetAttribute[0]);
487 488
488 if (this.currentKeyframeRule[i].keyText === "0%") { 489 if (this.currentKeyframeRule[i].keyText === "0%") {
489 newTween.spanWidth = 0; 490 newTween.spanWidth = 0;
@@ -492,8 +493,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
492 newTween.tweenID = 0; 493 newTween.tweenID = 0;
493 newTween.spanPosition = 0; 494 newTween.spanPosition = 0;
494 newTween.tweenedProperties = []; 495 newTween.tweenedProperties = [];
495 newTween.tweenedProperties["top"] = topOffSetAttribute[0]; 496 newTween.tweenedProperties["top"] = tempTopOffset;
496 newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; 497 newTween.tweenedProperties["left"] = tempLeftOffset;
497 this.tweens.push(newTween); 498 this.tweens.push(newTween);
498 499
499 } 500 }
@@ -501,30 +502,26 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
501 percentValue = this.currentKeyframeRule[i].keyText; 502 percentValue = this.currentKeyframeRule[i].keyText;
502 splitValue = percentValue.split("%"); 503 splitValue = percentValue.split("%");
503 fraction = splitValue[0] / 100; 504 fraction = splitValue[0] / 100;
504 this.currentMilliSec = fraction * this.trackDuration[0] * 1000; 505 currentMilliSec = fraction * trackTiming[0] * 1000;
505 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 506 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
506 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 507 clickPosition = currentMilliSec / currentMilliSecPerPixel;
507 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; 508 newTween.spanWidth = clickPosition - this.tweens[this.tweens.length - 1].keyFramePosition;
508 newTween.keyFramePosition = this.clickPos; 509 newTween.keyFramePosition = clickPosition;
509 newTween.keyFrameMillisec = this.currentMilliSec; 510 newTween.keyFrameMillisec = currentMilliSec;
510 newTween.tweenID = this.nextKeyframe; 511 newTween.tweenID = this.nextKeyframe;
511 newTween.spanPosition = this.clickPos - newTween.spanWidth; 512 newTween.spanPosition =clickPosition - newTween.spanWidth;
512 newTween.tweenedProperties=[]; 513 newTween.tweenedProperties=[];
513 newTween.tweenedProperties["top"] = topOffSetAttribute[0]; 514 newTween.tweenedProperties["top"] = tempTopOffset;
514 newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; 515 newTween.tweenedProperties["left"] = tempLeftOffset;
515 this.tweens.push(newTween); 516 this.tweens.push(newTween);
516 517
517 518
518 } 519 }
519 i++;
520 this.nextKeyframe += 1; 520 this.nextKeyframe += 1;
521 } 521 }
522 this.isTrackAnimated = true; 522 this.isTrackAnimated = true;
523 } 523 }
524 } 524 }
525 else{
526 return;
527 }
528 } 525 }
529 }, 526 },
530 527