diff options
author | Jonathan Duran | 2012-06-19 12:44:58 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-06-19 12:44:58 -0700 |
commit | a065caf8793cafe5508bffe572ba95e0017840b8 (patch) | |
tree | 07ce66db42f246b3b086109c6897a8acafe0a066 /js/panels | |
parent | 8a3fb9c3f9b3497884ec7e898924b13dad1d685a (diff) | |
download | ninja-a065caf8793cafe5508bffe572ba95e0017840b8.tar.gz |
Lock Position and Size keyframes to main track keyframes
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels')
-rw-r--r-- | js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 15 | ||||
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 20 |
2 files changed, 20 insertions, 15 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 0605e300..3a998617 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | |||
@@ -17,7 +17,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
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.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 | }, |
@@ -180,7 +180,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
180 | if (ev.shiftKey) { | 180 | if (ev.shiftKey) { |
181 | 181 | ||
182 | if (this.trackType == "position") { | 182 | if (this.trackType == "position") { |
183 | this.parentComponent.parentComponent.parentComponent.handleNewTween(ev); | 183 | this.parentComponent.parentComponent.parentComponent.parentComponent.handleNewTween(ev); |
184 | } | 184 | } |
185 | 185 | ||
186 | if (this.propTweens.length < 1) { | 186 | if (this.propTweens.length < 1) { |
@@ -199,16 +199,17 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
199 | this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty; | 199 | this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[currentSelectedStyleIndex].editorProperty; |
200 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); | 200 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); |
201 | } | 201 | } |
202 | this.insertPropTween(0); | ||
203 | this.addPropAnimationRuleToElement(ev); | ||
204 | this.updatePropKeyframeRule(); | ||
202 | } else if (this.trackType == "position") { | 205 | } else if (this.trackType == "position") { |
203 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); | 206 | //console.log("Property track editorProperty set to: " + this.trackEditorProperty); |
204 | } | 207 | } |
205 | |||
206 | this.insertPropTween(0); | ||
207 | this.addPropAnimationRuleToElement(ev); | ||
208 | this.updatePropKeyframeRule(); | ||
209 | } else { | 208 | } else { |
210 | this.handleNewPropTween(ev); | 209 | this.handleNewPropTween(ev); |
211 | this.updatePropKeyframeRule(); | 210 | if (this.trackType == "style") { |
211 | this.updatePropKeyframeRule(); | ||
212 | } | ||
212 | } | 213 | } |
213 | } | 214 | } |
214 | } | 215 | } |
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 26ccfe09..1a8b6f4e 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -763,12 +763,16 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
763 | newTween.tweenData.keyFrameMillisec = 0; | 763 | newTween.tweenData.keyFrameMillisec = 0; |
764 | newTween.tweenData.tweenID = 0; | 764 | newTween.tweenData.tweenID = 0; |
765 | newTween.tweenData.spanPosition = 0; | 765 | newTween.tweenData.spanPosition = 0; |
766 | newTween.tweenData.easing = "none"; | ||
766 | newTween.tweenData.tweenedProperties = []; | 767 | newTween.tweenData.tweenedProperties = []; |
767 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px"; | 768 | newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop + "px"; |
768 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px"; | 769 | newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft + "px"; |
769 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px"; | 770 | newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth + "px"; |
770 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px"; | 771 | newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight + "px"; |
771 | this.tweens.push(newTween); | 772 | this.tweens.push(newTween); |
773 | |||
774 | this.createMatchingPositionSizeTween(newTween); | ||
775 | |||
772 | } else { | 776 | } else { |
773 | newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; | 777 | newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; |
774 | newTween.tweenData.keyFramePosition = clickPos; | 778 | newTween.tweenData.keyFramePosition = clickPos; |
@@ -787,21 +791,22 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
787 | var animationDuration = (this.trackDuration / 1000) + "s"; | 791 | var animationDuration = (this.trackDuration / 1000) + "s"; |
788 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration); | 792 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration); |
789 | this.nextKeyframe += 1; | 793 | this.nextKeyframe += 1; |
794 | |||
795 | this.createMatchingPositionSizeTween(newTween); | ||
790 | } | 796 | } |
791 | 797 | ||
792 | this.createMatchingPositionSizeTweens(clickPos); | 798 | |
793 | 799 | ||
794 | this.application.ninja.currentDocument.model.needsSave = true; | 800 | this.application.ninja.currentDocument.model.needsSave = true; |
795 | } | 801 | } |
796 | }, | 802 | }, |
797 | 803 | ||
798 | createMatchingPositionSizeTweens:{ | 804 | createMatchingPositionSizeTween:{ |
799 | value:function (position) { | 805 | value:function (newTween) { |
800 | console.log(this.positionTracksRepetition); | ||
801 | var i; | 806 | var i; |
802 | var posTracks = this.positionTracksRepetition.length; | 807 | var posTracks = this.positionTracksRepetition.childComponents.length; |
803 | for (i = 0; i < posTracks; i++) { | 808 | for (i = 0; i < posTracks; i++) { |
804 | 809 | this.positionTracksRepetition.childComponents[i].propTweens.push(newTween); | |
805 | } | 810 | } |
806 | } | 811 | } |
807 | }, | 812 | }, |
@@ -812,8 +817,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
812 | i, | 817 | i, |
813 | tweensLength = this.tweens.length-1, | 818 | tweensLength = this.tweens.length-1, |
814 | prevTween, nextTween, splitTweenIndex; | 819 | prevTween, nextTween, splitTweenIndex; |
815 | 820 | ||
816 | consol.log(ev.target.className) | ||
817 | for(i=0; i<tweensLength; i++){ | 821 | for(i=0; i<tweensLength; i++){ |
818 | prevTween = this.tweens[i].tweenData.keyFramePosition; | 822 | prevTween = this.tweens[i].tweenData.keyFramePosition; |
819 | nextTween = this.tweens[i+1].tweenData.keyFramePosition; | 823 | nextTween = this.tweens[i+1].tweenData.keyFramePosition; |