aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/Tween.reel/Tween.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/Tween.reel/Tween.js')
-rw-r--r--js/panels/Timeline/Tween.reel/Tween.js76
1 files changed, 76 insertions, 0 deletions
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js
index 2b308d9a..28c9a585 100644
--- a/js/panels/Timeline/Tween.reel/Tween.js
+++ b/js/panels/Timeline/Tween.reel/Tween.js
@@ -44,6 +44,7 @@ var Tween = exports.Tween = Montage.create(Component, {
44 }, 44 },
45 set: function(value){ 45 set: function(value){
46 this._spanWidth = value; 46 this._spanWidth = value;
47 this.needsDraw=true;
47 } 48 }
48 }, 49 },
49 50
@@ -58,6 +59,7 @@ var Tween = exports.Tween = Montage.create(Component, {
58 }, 59 },
59 set:function (value) { 60 set:function (value) {
60 this._spanPosition = value; 61 this._spanPosition = value;
62 this.needsDraw=true;
61 } 63 }
62 }, 64 },
63 65
@@ -72,6 +74,7 @@ var Tween = exports.Tween = Montage.create(Component, {
72 }, 74 },
73 set:function (value) { 75 set:function (value) {
74 this._keyFramePosition = value; 76 this._keyFramePosition = value;
77 this.needsDraw=true;
75 } 78 }
76 }, 79 },
77 80
@@ -133,6 +136,12 @@ var Tween = exports.Tween = Montage.create(Component, {
133 } 136 }
134 }, 137 },
135 138
139 prepareForDraw:{
140 value:function(){
141 this.eventManager.addEventListener("tlZoomSlider", this, false);
142 }
143 },
144
136 draw:{ 145 draw:{
137 value:function () { 146 value:function () {
138 this.element.style.left = this.spanPosition + "px"; 147 this.element.style.left = this.spanPosition + "px";
@@ -203,6 +212,7 @@ var Tween = exports.Tween = Montage.create(Component, {
203 // move animated element to correct position on stage 212 // move animated element to correct position on stage
204 var currentTop = this.tweenedProperties["top"] + "px"; 213 var currentTop = this.tweenedProperties["top"] + "px";
205 var currentLeft = this.tweenedProperties["left"] + "px"; 214 var currentLeft = this.tweenedProperties["left"] + "px";
215
206 ElementsMediator.setProperty([this.parentComponent.parentComponent.animatedElement], "top", [currentTop], "Change", "tween"); 216 ElementsMediator.setProperty([this.parentComponent.parentComponent.animatedElement], "top", [currentTop], "Change", "tween");
207 ElementsMediator.setProperty([this.parentComponent.parentComponent.animatedElement], "left", [currentLeft], "Change", "tween"); 217 ElementsMediator.setProperty([this.parentComponent.parentComponent.animatedElement], "left", [currentLeft], "Change", "tween");
208 218
@@ -217,5 +227,71 @@ var Tween = exports.Tween = Montage.create(Component, {
217 // deselect the keyframe for this tween 227 // deselect the keyframe for this tween
218 this.keyframe.deselectKeyframe(); 228 this.keyframe.deselectKeyframe();
219 } 229 }
230 },
231
232 handleTlZoomSlider:{
233 value:function(event){
234 var currentMilliSecPerPixel , currentMilliSec , clickPos,i=0;
235
236 length = this.application.ninja.timeline.tempArray.length;
237 if(length > 0 && this.application.ninja.timeline.tempArray[length-1]!== this.parentComponent.parentComponent.trackID){
238 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
239 var i = this.application.ninja.timeline.tweenarray.length-1;
240 for(;this.currentTween = this.application.ninja.timeline.tweenarray[i];i--){
241 if(this.application.ninja.timeline.tweenarray[i].tweenID===0){
242 this.currentTween.spanWidth=0;
243 this.currentTween.spanPosition=0;
244 this.currentTween.keyFramePosition=0;
245 this.currentTween.keyFrameMillisec=0;
246 this.needsDraw=true;
247 }else{
248 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
249 currentMilliSec = this.currentTween.keyFrameMillisec;
250 clickPos = currentMilliSec / currentMilliSecPerPixel;
251 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[i+1].keyFramePosition;
252 this.currentTween.keyFramePosition = clickPos;
253 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
254 this.needsDraw=true;
255 }
256
257 }
258 this.application.ninja.timeline.tweenarray.length=0;
259 this.application.ninja.timeline.tweenarray.push(this);
260 }else if(length===0){
261 this.application.ninja.timeline.tempArray.push(this.parentComponent.parentComponent.trackID);
262 this.application.ninja.timeline.tweenarray.push(this);
263 }else{
264 this.application.ninja.timeline.tweenarray.push(this);
265 }
266
267 var levelNumber = this.application.ninja.timeline.getLayerIndexByID(this.parentComponent.parentComponent.trackID);
268 var k = this.application.ninja.timeline.tweenarray.length-1;
269 if(this.parentComponent.parentComponent.tweens.length === this.application.ninja.timeline.tweenarray.length && levelNumber===0){
270 for(;this.currentTween = this.application.ninja.timeline.tweenarray[k];k--){
271 if(this.application.ninja.timeline.tweenarray[k].tweenID===0){
272 this.currentTween.spanWidth=0;
273 this.currentTween.spanPosition=0;
274 this.currentTween.keyFramePosition=0;
275 this.currentTween.keyFrameMillisec=0;
276 this.needsDraw=true;
277 }else{
278 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
279 currentMilliSec = this.currentTween.keyFrameMillisec;
280 clickPos = currentMilliSec / currentMilliSecPerPixel;
281 this.currentTween.spanWidth = clickPos-this.application.ninja.timeline.tweenarray[k+1].keyFramePosition;
282 this.currentTween.keyFramePosition = clickPos;
283 this.currentTween.spanPosition=clickPos-this.currentTween.spanWidth;
284 this.needsDraw=true;
285 }
286
287 }
288 this.application.ninja.timeline.tempArray.length=0;
289 this.application.ninja.timeline.tweenarray.length=0;
290 }
291
292
293
294 }
220 } 295 }
296
221}); 297});