From 0b18fb2fef124a26204d5dba90cd82c975b69df3 Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Thu, 23 Feb 2012 17:06:48 -0800 Subject: Timeline: Add hottext fields to layers and serialize them throughout. --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'js/panels/Timeline/TimelineTrack.reel') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index fddfd170..67dbbced 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -358,10 +358,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { didDraw:{ value:function () { - if (this._openDocRedrawCheck) { - this.retrieveStoredTweens(); - this._openDocRedrawCheck = false; - } + if(this.application.ninja.currentDocument.documentRoot.children[0]){ + if (this._openDocRedrawCheck) { + this.retrieveStoredTweens(); + this._openDocRedrawCheck = false; + } + } } }, @@ -542,7 +544,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { value:function () { var that = this; - this.arrPositionTracks = [0, 1, 2]; + this.arrPositionTracks = [0, 1]; this.arrTransformTracks = [0, 1, 2, 3, 4]; this.label = this.element.querySelector(".label-main"); -- cgit v1.2.3 From 1c4e8fbab587e589f348223847d6aac5c2df416b Mon Sep 17 00:00:00 2001 From: Jon Reid Date: Fri, 24 Feb 2012 14:06:57 -0800 Subject: Timeline: Bug fixes: Delete corresponding track when a style is deleted from a layer, and fix serialization variable problem. --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/panels/Timeline/TimelineTrack.reel') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 27177a69..30280727 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -652,6 +652,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { this._styleCollapser.bypassAnimation = layerEvent.bypassAnimation; this._styleCollapser.handleCollapserLabelClick(); } + } else if (layerEvent.layerEventType === "deleteStyle") { + this.arrStyleTracks.pop(); } } } -- cgit v1.2.3 From 47b025b90af2a5d43dddf3b41f8c96fd26c3e4f1 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Sat, 25 Feb 2012 16:26:31 -0800 Subject: Timeline : Adding Tweens Properties Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'js/panels/Timeline/TimelineTrack.reel') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 30280727..d837997a 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -462,7 +462,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { retrieveStoredTweens:{ value:function () { - var percentValue, fraction, splitValue, i = 0; + var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0; this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0]; this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); @@ -478,12 +478,22 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { while (this.currentKeyframeRule[i]) { var newTween = {}; + offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); + topOffSetAttribute = offsetAttribute[3].split("px"); + leftOffsetAttribute = offsetAttribute[5].split("px"); + + parseInt(topOffSetAttribute[0]); + parseInt(leftOffsetAttribute[0]); + if (this.currentKeyframeRule[i].keyText === "0%") { newTween.spanWidth = 0; newTween.keyFramePosition = 0; newTween.keyFrameMillisec = 0; newTween.tweenID = 0; newTween.spanPosition = 0; + newTween.tweenedProperties = []; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; this.tweens.push(newTween); } @@ -499,6 +509,9 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { newTween.keyFrameMillisec = this.currentMilliSec; newTween.tweenID = this.nextKeyframe; newTween.spanPosition = this.clickPos - newTween.spanWidth; + newTween.tweenedProperties=[]; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; this.tweens.push(newTween); -- cgit v1.2.3 From 7965d1e56ee6e02d049f4e1a8eb5dad291967015 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Sat, 25 Feb 2012 16:29:33 -0800 Subject: Timeline: Order of tweens and corresponding layers taken care over Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/panels/Timeline/TimelineTrack.reel') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index d837997a..a36e666b 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -464,7 +464,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { value:function () { var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0; - this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0]; + var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].elementsList[0]; this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); if(this.animationDuration){ -- cgit v1.2.3 From 125723cf19cf70121bc694909d09a301ca2fc2d6 Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Mon, 27 Feb 2012 11:40:52 -0800 Subject: Timeline: RetrieveStoredTweens calling fixed Signed-off-by: Kruti Shah Signed-off-by: Jonathan Duran --- .../Timeline/TimelineTrack.reel/TimelineTrack.js | 121 +++++++++++---------- 1 file changed, 61 insertions(+), 60 deletions(-) (limited to 'js/panels/Timeline/TimelineTrack.reel') diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index a36e666b..55c84dce 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js @@ -331,10 +331,6 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { _styleCollapser:{ value:null }, - _openDocRedrawCheck:{ - value:true, - writable:true - }, prepareForDraw:{ value:function () { this.init(); @@ -364,10 +360,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { didDraw:{ value:function () { - if(this.application.ninja.currentDocument.documentRoot.children[0]){ - if (this._openDocRedrawCheck) { - this.retrieveStoredTweens(); - this._openDocRedrawCheck = false; + if(!this.application.ninja.documentController.creatingNewFile){ + if(this.application.ninja.currentDocument.documentRoot.children[0]){ + var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + if(!this.application.ninja.timeline.arrLayers[selectedIndex].created){ + this.retrieveStoredTweens(); + } } } } @@ -465,60 +463,63 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { var percentValue, fraction, splitValue,offsetAttribute,topOffSetAttribute,leftOffsetAttribute, i = 0; var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); + this.application.ninja.timeline.arrLayers[selectedIndex].created=true; this.animatedElement = this.application.ninja.timeline.arrLayers[selectedIndex].elementsList[0]; - this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); - this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); - if(this.animationDuration){ - this.trackDuration = this.animationDuration.split("s"); - this.currentMilliSec = this.trackDuration[0] * 1000; - this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; - this.nextKeyframe = 0; - - this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); - while (this.currentKeyframeRule[i]) { - var newTween = {}; - - offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); - topOffSetAttribute = offsetAttribute[3].split("px"); - leftOffsetAttribute = offsetAttribute[5].split("px"); - - parseInt(topOffSetAttribute[0]); - parseInt(leftOffsetAttribute[0]); - - if (this.currentKeyframeRule[i].keyText === "0%") { - newTween.spanWidth = 0; - newTween.keyFramePosition = 0; - newTween.keyFrameMillisec = 0; - newTween.tweenID = 0; - newTween.spanPosition = 0; - newTween.tweenedProperties = []; - newTween.tweenedProperties["top"] = topOffSetAttribute[0]; - newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; - this.tweens.push(newTween); - - } - else { - percentValue = this.currentKeyframeRule[i].keyText; - splitValue = percentValue.split("%"); - fraction = splitValue[0] / 100; - this.currentMilliSec = fraction * this.trackDuration[0] * 1000; - this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); - this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; - newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; - newTween.keyFramePosition = this.clickPos; - newTween.keyFrameMillisec = this.currentMilliSec; - newTween.tweenID = this.nextKeyframe; - newTween.spanPosition = this.clickPos - newTween.spanWidth; - newTween.tweenedProperties=[]; - newTween.tweenedProperties["top"] = topOffSetAttribute[0]; - newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; - this.tweens.push(newTween); - - + if(this.animatedElement!==undefined){ + this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); + if(this.animationName){ + this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); + this.trackDuration = this.animationDuration.split("s"); + this.currentMilliSec = this.trackDuration[0] * 1000; + this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; + this.nextKeyframe = 0; + + this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); + while (this.currentKeyframeRule[i]) { + var newTween = {}; + + offsetAttribute = this.currentKeyframeRule[i].cssText.split(" "); + topOffSetAttribute = offsetAttribute[3].split("px"); + leftOffsetAttribute = offsetAttribute[5].split("px"); + + parseInt(topOffSetAttribute[0]); + parseInt(leftOffsetAttribute[0]); + + if (this.currentKeyframeRule[i].keyText === "0%") { + newTween.spanWidth = 0; + newTween.keyFramePosition = 0; + newTween.keyFrameMillisec = 0; + newTween.tweenID = 0; + newTween.spanPosition = 0; + newTween.tweenedProperties = []; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; + this.tweens.push(newTween); + + } + else { + percentValue = this.currentKeyframeRule[i].keyText; + splitValue = percentValue.split("%"); + fraction = splitValue[0] / 100; + this.currentMilliSec = fraction * this.trackDuration[0] * 1000; + this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); + this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; + newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; + newTween.keyFramePosition = this.clickPos; + newTween.keyFrameMillisec = this.currentMilliSec; + newTween.tweenID = this.nextKeyframe; + newTween.spanPosition = this.clickPos - newTween.spanWidth; + newTween.tweenedProperties=[]; + newTween.tweenedProperties["top"] = topOffSetAttribute[0]; + newTween.tweenedProperties["left"] = leftOffsetAttribute[0]; + this.tweens.push(newTween); + + + } + i++; + this.nextKeyframe += 1; } - i++; - this.nextKeyframe += 1; } } else{ -- cgit v1.2.3