aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Duran2012-04-24 08:46:22 -0700
committerJonathan Duran2012-04-24 08:46:22 -0700
commit47488a6ff1b7fc32e2485b3dd82afe207b936b35 (patch)
treeff84f8f08d7c38c1b729ba89e0670d78249d79ef
parent12fadd1494a9b5fcdaa17fde2f4847277237cf79 (diff)
downloadninja-47488a6ff1b7fc32e2485b3dd82afe207b936b35.tar.gz
Turn on width and height as tweenable properties
Signed-off-by: Jonathan Duran <jduran@motorola.com>
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js29
2 files changed, 31 insertions, 2 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index e79602e7..e46a5eb0 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -578,6 +578,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
578 newTween.tweenData.tweenedProperties = []; 578 newTween.tweenData.tweenedProperties = [];
579 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 579 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop;
580 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 580 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft;
581 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth;
582 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight;
581 this.tweens.push(newTween); 583 this.tweens.push(newTween);
582 } else { 584 } else {
583 newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition; 585 newTween.tweenData.spanWidth = clickPos - this.tweens[this.tweens.length - 1].tweenData.keyFramePosition;
@@ -588,6 +590,8 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
588 newTween.tweenData.tweenedProperties = []; 590 newTween.tweenData.tweenedProperties = [];
589 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop; 591 newTween.tweenData.tweenedProperties["top"] = this.animatedElement.offsetTop;
590 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft; 592 newTween.tweenData.tweenedProperties["left"] = this.animatedElement.offsetLeft;
593 newTween.tweenData.tweenedProperties["width"] = this.animatedElement.offsetWidth;
594 newTween.tweenData.tweenedProperties["height"] = this.animatedElement.offsetHeight;
591 this.tweens.push(newTween); 595 this.tweens.push(newTween);
592 596
593 // update the animation duration 597 // update the animation duration
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 7dcd397c..b13a037f 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -186,11 +186,36 @@ var Tween = exports.Tween = Montage.create(Component, {
186 setAbsoluteTweenProperties:{ 186 setAbsoluteTweenProperties:{
187 value:function (eventDetail) { 187 value:function (eventDetail) {
188 //console.log(eventDetail); 188 //console.log(eventDetail);
189 if (this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"] && this.parentComponent.parentComponent.animatedElement.offsetLeft != this.tweenedProperties["left"]) { 189
190 // top
191 if(this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"]){
190 this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop; 192 this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop;
193 }
194
195 // left
196 if(this.parentComponent.parentComponent.animatedElement.offsetLeft != this.tweenedProperties["left"]){
191 this.tweenedProperties["left"] = this.parentComponent.parentComponent.animatedElement.offsetLeft; 197 this.tweenedProperties["left"] = this.parentComponent.parentComponent.animatedElement.offsetLeft;
192 this.parentComponent.parentComponent.updateKeyframeRule();
193 } 198 }
199
200 // width
201 if (this.parentComponent.parentComponent.animatedElement.offsetWidth != this.tweenedProperties["width"]){
202 this.tweenedProperties["width"] = this.parentComponent.parentComponent.animatedElement.offsetWidth;
203 }
204
205 // height
206 if (this.parentComponent.parentComponent.animatedElement.offsetHeight != this.tweenedProperties["height"]){
207 this.tweenedProperties["height"] = this.parentComponent.parentComponent.animatedElement.offsetHeight;
208 }
209
210 // skewX
211
212 // skewY
213
214 // rotation
215
216 // tell track to update css rule
217 this.parentComponent.parentComponent.updateKeyframeRule();
218
194 // highlight the tween's span 219 // highlight the tween's span
195 this.tweenspan.highlightSpan(); 220 this.tweenspan.highlightSpan();
196 this.isTweenAnimated = true; 221 this.isTweenAnimated = true;