aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/PropertyTrack.reel
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-07-02 09:23:13 -0700
committerNivesh Rajbhandari2012-07-02 09:23:13 -0700
commit2bae1b3148233288ec0bc50876935bdfea1f288c (patch)
tree686fa3b5b9615941bb7013f35c91e8f326b049db /js/panels/Timeline/PropertyTrack.reel
parent2da05a4c71bfe9b136384d9e94fbfbef19f24550 (diff)
parent12de4e49a309e210c13eb40b2ffa158ef2eb54a7 (diff)
downloadninja-2bae1b3148233288ec0bc50876935bdfea1f288c.tar.gz
Merge branch 'refs/heads/ninja-internal' into MaterialsUI
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel')
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 66f39b5a..72d26e78 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -16,8 +16,8 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
16 prepareForDraw:{ 16 prepareForDraw:{
17 value:function(){ 17 value:function(){
18 this.element.addEventListener("click", this, false); 18 this.element.addEventListener("click", this, false);
19 this.trackID = this.parentComponent.parentComponent.parentComponent.trackID; 19 this.trackID = this.parentComponent.parentComponent.parentComponent.parentComponent.trackID;
20 this.animatedElement = this.parentComponent.parentComponent.parentComponent.animatedElement; 20 this.animatedElement = this.parentComponent.parentComponent.parentComponent.parentComponent.animatedElement;
21 this.ninjaStylesContoller = this.application.ninja.stylesController; 21 this.ninjaStylesContoller = this.application.ninja.stylesController;
22 } 22 }
23 }, 23 },
@@ -442,12 +442,12 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
442 442
443 for (var i = 0; i < this.propTweens.length; i++) { 443 for (var i = 0; i < this.propTweens.length; i++) {
444 var keyMill = parseInt(this.propTweens[i].tweenData.keyFrameMillisec); 444 var keyMill = parseInt(this.propTweens[i].tweenData.keyFrameMillisec);
445 // TODO - trackDur should be parseFloat rounded to significant digits 445 // trackDur should be parseFloat rounded to significant digits
446 var trackDur = parseInt(this.trackDuration); 446 var trackDur = parseInt(this.trackDuration);
447 var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%"; 447 var keyframePercent = Math.round((keyMill / trackDur) * 100) + "%";
448 var keyframePropertyString = " " + keyframePercent + " {"; 448 var keyframePropertyString = " " + keyframePercent + " {";
449 for(var prop in this.propTweens[i].tweenData.tweenedProperties){ 449 for(var prop in this.propTweens[i].tweenData.tweenedProperties){
450 keyframePropertyString += prop + ": " + this.propTweens[i].tweenData.tweenedProperties[prop]; 450 keyframePropertyString += prop + ": " + this.propTweens[i].tweenData.tweenedProperties[prop] + ";";
451 } 451 }
452 keyframePropertyString += "}"; 452 keyframePropertyString += "}";
453 keyframeString += keyframePropertyString; 453 keyframeString += keyframePropertyString;
@@ -465,30 +465,31 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
465 if (currentStyleValue == null) { 465 if (currentStyleValue == null) {
466 currentStyleValue = "1px"; 466 currentStyleValue = "1px";
467 } 467 }
468 console.log(currentStyleValue);
469 468
470 this.propTweens[0].tweenData.tweenedProperties[this.trackEditorProperty] = currentStyleValue; 469 this.propTweens[0].tweenData.tweenedProperties[this.trackEditorProperty] = currentStyleValue;
471 470
472
473 this.animationName = this.animatedElement.classList[0] + "_" + this.trackEditorProperty; 471 this.animationName = this.animatedElement.classList[0] + "_" + this.trackEditorProperty;
474 var currentAnimationNameString = this.parentComponent.parentComponent.parentComponent.animationNamesString; 472 var currentAnimationNameString = this.parentComponent.parentComponent.parentComponent.parentComponent.animationNamesString;
475 var newAnimationNames = currentAnimationNameString + "," + this.animationName; 473 var newAnimationNames = "";
474 if(currentAnimationNameString.length == 0){
475 newAnimationNames = this.animationName;
476 } else {
477 newAnimationNames = currentAnimationNameString + "," + this.animationName;
478 }
476 var currentAnimationDuration = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-duration"); 479 var currentAnimationDuration = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-duration");
477 var newAnimationDuration = currentAnimationDuration + "," + currentAnimationDuration; 480 var newAnimationDuration = currentAnimationDuration + "," + currentAnimationDuration;
478 var currentIterationCount = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-iteration-count"); 481 var currentIterationCount = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-iteration-count");
479 var newIterationCount = currentIterationCount + ",1"; 482 var newIterationCount = currentIterationCount + ",1";
480 483
481 this.parentComponent.parentComponent.parentComponent.animationNamesString = newAnimationNames; 484 this.parentComponent.parentComponent.parentComponent.parentComponent.animationNamesString = newAnimationNames;
482 485
483 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", newAnimationNames); 486 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", newAnimationNames);
484
485 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", newAnimationDuration); 487 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", newAnimationDuration);
488 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-fill-mode", "forwards");
486 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", newIterationCount); 489 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", newIterationCount);
487 490
488 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} 100% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} }"; 491 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} 100% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} }";
489 console.log(initRule);
490 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule); 492 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule);
491
492 this.insertPropTween(tweenEvent.offsetX); 493 this.insertPropTween(tweenEvent.offsetX);
493 } 494 }
494 } 495 }