diff options
author | Kruti Shah | 2012-07-09 11:30:37 -0700 |
---|---|---|
committer | Kruti Shah | 2012-07-09 11:30:37 -0700 |
commit | 35a31845720beb1296dc42a79fa068601dfc52cb (patch) | |
tree | 252ba58a3f2bb9600262c48571cc3dabaee36449 /js/panels/Timeline/Tween.reel | |
parent | b35edd96135bd8c2b500ffee08474bacd17c25ac (diff) | |
parent | 39aa69624e1e3b8598b0242ee6ec436862b67280 (diff) | |
download | ninja-35a31845720beb1296dc42a79fa068601dfc52cb.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/panels/Timeline/Tween.reel')
-rw-r--r-- | js/panels/Timeline/Tween.reel/Tween.html | 34 | ||||
-rw-r--r-- | js/panels/Timeline/Tween.reel/Tween.js | 105 | ||||
-rw-r--r-- | js/panels/Timeline/Tween.reel/css/Tween.css | 34 |
3 files changed, 114 insertions, 59 deletions
diff --git a/js/panels/Timeline/Tween.reel/Tween.html b/js/panels/Timeline/Tween.reel/Tween.html index aba42436..e27aeb89 100644 --- a/js/panels/Timeline/Tween.reel/Tween.html +++ b/js/panels/Timeline/Tween.reel/Tween.html | |||
@@ -1,9 +1,33 @@ | |||
1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
2 | <!-- <copyright> | 2 | <!-- <copyright> |
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 3 | Copyright (c) 2012, Motorola Mobility, Inc |
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 4 | All Rights Reserved. |
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 5 | BSD License. |
6 | </copyright> --> | 6 | |
7 | Redistribution and use in source and binary forms, with or without | ||
8 | modification, are permitted provided that the following conditions are met: | ||
9 | |||
10 | - Redistributions of source code must retain the above copyright notice, | ||
11 | this list of conditions and the following disclaimer. | ||
12 | - Redistributions in binary form must reproduce the above copyright | ||
13 | notice, this list of conditions and the following disclaimer in the | ||
14 | documentation and/or other materials provided with the distribution. | ||
15 | - Neither the name of Motorola Mobility nor the names of its contributors | ||
16 | may be used to endorse or promote products derived from this software | ||
17 | without specific prior written permission. | ||
18 | |||
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
29 | POSSIBILITY OF SUCH DAMAGE. | ||
30 | </copyright> --> | ||
7 | <html lang="en"> | 31 | <html lang="en"> |
8 | <head> | 32 | <head> |
9 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | 33 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
@@ -43,4 +67,4 @@ | |||
43 | </div> | 67 | </div> |
44 | 68 | ||
45 | </body> | 69 | </body> |
46 | </html> \ No newline at end of file | 70 | </html> |
diff --git a/js/panels/Timeline/Tween.reel/Tween.js b/js/panels/Timeline/Tween.reel/Tween.js index 0d189fba..85fdfdc9 100644 --- a/js/panels/Timeline/Tween.reel/Tween.js +++ b/js/panels/Timeline/Tween.reel/Tween.js | |||
@@ -1,8 +1,32 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | All Rights Reserved. |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | BSD License. |
5 | </copyright> */ | 5 | |
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, are permitted provided that the following conditions are met: | ||
8 | |||
9 | - Redistributions of source code must retain the above copyright notice, | ||
10 | this list of conditions and the following disclaimer. | ||
11 | - Redistributions in binary form must reproduce the above copyright | ||
12 | notice, this list of conditions and the following disclaimer in the | ||
13 | documentation and/or other materials provided with the distribution. | ||
14 | - Neither the name of Motorola Mobility nor the names of its contributors | ||
15 | may be used to endorse or promote products derived from this software | ||
16 | without specific prior written permission. | ||
17 | |||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
28 | POSSIBILITY OF SUCH DAMAGE. | ||
29 | </copyright> */ | ||
6 | 30 | ||
7 | var Montage = require("montage/core/core").Montage; | 31 | var Montage = require("montage/core/core").Montage; |
8 | var Component = require("montage/ui/component").Component; | 32 | var Component = require("montage/ui/component").Component; |
@@ -11,6 +35,7 @@ var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | |||
11 | 35 | ||
12 | var Tween = exports.Tween = Montage.create(Component, { | 36 | var Tween = exports.Tween = Montage.create(Component, { |
13 | 37 | ||
38 | // ==== Begin Models | ||
14 | keyframe: { | 39 | keyframe: { |
15 | value: null, | 40 | value: null, |
16 | serializable: true | 41 | serializable: true |
@@ -184,6 +209,23 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
184 | } | 209 | } |
185 | }, | 210 | }, |
186 | 211 | ||
212 | setData:{ | ||
213 | value:function(){ | ||
214 | this.spanWidth = this.tweenData.spanWidth; | ||
215 | this.keyFramePosition = this.tweenData.keyFramePosition; | ||
216 | this.spanPosition = this.tweenData.spanPosition; | ||
217 | this.keyFrameMillisec = this.tweenData.keyFrameMillisec; | ||
218 | this.tweenID = this.tweenData.tweenID; | ||
219 | this.tweenedProperties = this.tweenData.tweenedProperties; | ||
220 | this.isTweenAnimated = this.tweenData.isTweenAnimated; | ||
221 | this.easing = this.tweenData.easing; | ||
222 | this.initSelect = this.tweenData.initSelect; | ||
223 | this.needsDraw = true; | ||
224 | } | ||
225 | }, | ||
226 | // ==== End Models | ||
227 | |||
228 | // ==== Begin Draw cycle methods | ||
187 | prepareForDraw:{ | 229 | prepareForDraw:{ |
188 | value:function(){ | 230 | value:function(){ |
189 | if(this.initSelect){ | 231 | if(this.initSelect){ |
@@ -206,37 +248,19 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
206 | } | 248 | } |
207 | } | 249 | } |
208 | }, | 250 | }, |
251 | // ==== End Draw cycle methods | ||
209 | 252 | ||
210 | setData:{ | 253 | // ==== Begin Event handlers |
211 | value:function(){ | ||
212 | this.spanWidth = this.tweenData.spanWidth; | ||
213 | this.keyFramePosition = this.tweenData.keyFramePosition; | ||
214 | this.spanPosition = this.tweenData.spanPosition; | ||
215 | this.keyFrameMillisec = this.tweenData.keyFrameMillisec; | ||
216 | this.tweenID = this.tweenData.tweenID; | ||
217 | this.tweenedProperties = this.tweenData.tweenedProperties; | ||
218 | this.isTweenAnimated = this.tweenData.isTweenAnimated; | ||
219 | this.easing = this.tweenData.easing; | ||
220 | this.initSelect = this.tweenData.initSelect; | ||
221 | this.needsDraw = true; | ||
222 | } | ||
223 | }, | ||
224 | |||
225 | handleElementChange:{ | 254 | handleElementChange:{ |
226 | value:function (event) { | 255 | value:function (event) { |
227 | // temp - testing var | ||
228 | var useAbsolute = true; | ||
229 | |||
230 | if(event.detail.type === "cssChange"){ | 256 | if(event.detail.type === "cssChange"){ |
231 | event.detail.source="cssPanelChange" | 257 | event.detail.source="cssPanelChange" |
232 | } | 258 | } |
233 | |||
234 | if (event.detail.source && event.detail.source !== "tween") { | 259 | if (event.detail.source && event.detail.source !== "tween") { |
235 | 260 | ||
236 | if(this.parentComponent.parentComponent.isSubproperty){ | 261 | if(this.parentComponent.parentComponent.isSubproperty){ |
237 | this.setStyleTweenProperty(event.detail); | 262 | this.setStyleTweenProperty(event.detail); |
238 | } else { | 263 | } else { |
239 | // check for correct element selection | ||
240 | if (this.application.ninja.selectedElements[0] != this.parentComponent.parentComponent.animatedElement) { | 264 | if (this.application.ninja.selectedElements[0] != this.parentComponent.parentComponent.animatedElement) { |
241 | console.log("Wrong element selected for this keyframe track"); | 265 | console.log("Wrong element selected for this keyframe track"); |
242 | } else { | 266 | } else { |
@@ -246,10 +270,11 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
246 | } | 270 | } |
247 | } | 271 | } |
248 | }, | 272 | }, |
273 | // ==== End Event handlers | ||
249 | 274 | ||
275 | // ==== Begin Controllers | ||
250 | setTweenProperties:{ | 276 | setTweenProperties:{ |
251 | value:function (eventDetail) { | 277 | value:function (eventDetail) { |
252 | |||
253 | if (eventDetail.source === "SelectionTool" || eventDetail.source === "timeline" || eventDetail.source === "pi" || eventDetail.source === "cssPanelChange") { | 278 | if (eventDetail.source === "SelectionTool" || eventDetail.source === "timeline" || eventDetail.source === "pi" || eventDetail.source === "cssPanelChange") { |
254 | if(this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"]){ | 279 | if(this.parentComponent.parentComponent.animatedElement.offsetTop != this.tweenedProperties["top"]){ |
255 | this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop + "px"; | 280 | this.tweenedProperties["top"] = this.parentComponent.parentComponent.animatedElement.offsetTop + "px"; |
@@ -263,7 +288,7 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
263 | if (this.parentComponent.parentComponent.animatedElement.offsetHeight != this.tweenedProperties["height"]){ | 288 | if (this.parentComponent.parentComponent.animatedElement.offsetHeight != this.tweenedProperties["height"]){ |
264 | this.tweenedProperties["height"] = this.parentComponent.parentComponent.animatedElement.offsetHeight + "px"; | 289 | this.tweenedProperties["height"] = this.parentComponent.parentComponent.animatedElement.offsetHeight + "px"; |
265 | } | 290 | } |
266 | // tell track to update css rule | 291 | |
267 | this.parentComponent.parentComponent.updateKeyframeRule(); | 292 | this.parentComponent.parentComponent.updateKeyframeRule(); |
268 | this.isTweenAnimated = true; | 293 | this.isTweenAnimated = true; |
269 | } | 294 | } |
@@ -281,26 +306,17 @@ var Tween = exports.Tween = Montage.create(Component, { | |||
281 | 306 | ||
282 | setStyleTweenProperty:{ | 307 | setStyleTweenProperty:{ |
283 | value:function (eventDetail) { | 308 | value:function (eventDetail) { |
284 | //console.log("Setting style tween properties for: " + this.parentComponent.parentComponent.trackEditorProperty); | ||
285 | //console.log(eventDetail); | ||
286 | if(eventDetail.type == "setProperties"){ | 309 | if(eventDetail.type == "setProperties"){ |
287 | // need to ignore top, left, width, and height | ||
288 | //console.log(eventDetail.data.value[0]); | ||
289 | this.tweenedProperties[this.parentComponent.parentComponent.trackEditorProperty] = eventDetail.data.value[0]; |