aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/TimelineTrack.reel
diff options
context:
space:
mode:
authorJonathan Duran2012-02-09 11:17:47 -0800
committerJonathan Duran2012-02-09 11:17:47 -0800
commita822fec0e8e044b647306ed50619cb9a818269e4 (patch)
tree56ff7fb54b2cf80c594aa8a34989b6130fca8e4f /js/panels/Timeline/TimelineTrack.reel
parentf6ad57e346a7fac5efe64473642c80fff763299b (diff)
downloadninja-a822fec0e8e044b647306ed50619cb9a818269e4.tar.gz
Fixes for animation element assignment
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js35
1 files changed, 22 insertions, 13 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index dde01a2c..62688825 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -138,10 +138,23 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
138 value:false 138 value:false
139 }, 139 },
140 140
141 animatedElement:{ 141 _animatedElement:{
142 serializable:true,
143 enumerable:true,
144 writable:true,
142 value:null 145 value:null
143 }, 146 },
144 147
148 animatedElement:{
149 serializable:true,
150 get:function () {
151 return this._animatedElement;
152 },
153 set:function (val) {
154 this._animatedElement = val;
155 }
156 },
157
145 animationName:{ 158 animationName:{
146 value:null 159 value:null
147 }, 160 },
@@ -273,24 +286,20 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
273 286
274 addAnimationRuleToElement:{ 287 addAnimationRuleToElement:{
275 value:function (tweenEvent) { 288 value:function (tweenEvent) {
276 var theElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].element[0]; 289 this.animatedElement = this.application.ninja.timeline.currentLayerSelected.element[0];
277 this.animatedElement = theElement;
278
279 var initAnimatedProperties = new Array(); 290 var initAnimatedProperties = new Array();
280 initAnimatedProperties["top"] = theElement.offsetTop; 291 initAnimatedProperties["top"] = this.animatedElement.offsetTop;
281 initAnimatedProperties["left"] = theElement.offsetLeft; 292 initAnimatedProperties["left"] = this.animatedElement.offsetLeft;
282 this.keyFramePropertyData[0] = initAnimatedProperties; 293 this.keyFramePropertyData[0] = initAnimatedProperties;
283 294
284 var animationDuration = Math.round(this.trackDuration / 1000) + "s"; 295 var animationDuration = Math.round(this.trackDuration / 1000) + "s";
285 //console.log(this.application.ninja.timeline.arrLayers[this.trackID - 1].element[0]); 296 this.animationName = this.animatedElement.className + this.trackID;
286 //console.log(this.trackID);
287 this.animationName = this.application.ninja.timeline.arrLayers[this.trackID - 1].element[0].className + this.trackID;
288 297
289 this.ninjaStylesContoller.setElementStyle(theElement, "-webkit-animation-name", this.animationName); 298 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", this.animationName);
290 this.ninjaStylesContoller.setElementStyle(theElement, "-webkit-animation-duration", animationDuration); 299 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", animationDuration);
291 this.ninjaStylesContoller.setElementStyle(theElement, "-webkit-animation-iteration-count", "infinite"); 300 this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", "infinite");
292 301
293 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {top: " + theElement.offsetTop + "px; left: " + theElement.offsetLeft + "px;} 100% {top: " + theElement.offsetTop + "px; left: " + theElement.offsetLeft + "px;} }"; 302 var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} 100% {top: " + this.animatedElement.offsetTop + "px; left: " + this.animatedElement.offsetLeft + "px;} }";
294 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule); 303 this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule);
295 304
296 this.isAnimated = true; 305 this.isAnimated = true;