diff options
author | Jonathan Duran | 2012-05-09 09:58:27 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-05-09 09:58:27 -0700 |
commit | 48a2a800155fd2d608fb7191c0180cd8f625cd44 (patch) | |
tree | 899f9cf1b09a01bc073f92ab498236aed80b38ec /node_modules/montage/ui/flow-path.js | |
parent | 2ea8a62835f4c20efff2623306e7205e6f5bf0ba (diff) | |
parent | d220c02e246b30509b28a47fa04916ca2b8122e4 (diff) | |
download | ninja-48a2a800155fd2d608fb7191c0180cd8f625cd44.tar.gz |
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Conflicts:
js/panels/Timeline/TimelineTrack.reel/TimelineTrack.html
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'node_modules/montage/ui/flow-path.js')
-rw-r--r-- | node_modules/montage/ui/flow-path.js | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/node_modules/montage/ui/flow-path.js b/node_modules/montage/ui/flow-path.js new file mode 100644 index 00000000..51ecd63c --- /dev/null +++ b/node_modules/montage/ui/flow-path.js | |||
@@ -0,0 +1,215 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage").Montage; | ||
8 | |||
9 | var FlowPath = exports.FlowPath = Montage.create(Montage, { | ||
10 | |||
11 | _translateX: { | ||
12 | enumerable: false, | ||
13 | value: null | ||
14 | }, | ||
15 | translateX: { | ||
16 | get: function () { | ||
17 | return this._translateX; | ||
18 | }, | ||
19 | set: function (value) { | ||
20 | this._translateX = value; | ||
21 | this._updatePath(); | ||
22 | } | ||
23 | }, | ||
24 | |||
25 | _translateY: { | ||
26 | enumerable: false, | ||
27 | value: null | ||
28 | }, | ||
29 | translateY: { | ||
30 | get: function () { | ||
31 | return this._translateY; | ||
32 | }, | ||
33 | set: function (value) { | ||
34 | this._translateY = value; | ||
35 | this._updatePath(); | ||
36 | } | ||
37 | }, | ||
38 | |||
39 | _translateZ: { | ||
40 | enumerable: false, | ||
41 | value: null | ||
42 | }, | ||
43 | translateZ: { | ||
44 | get: function () { | ||
45 | return this._translateZ; | ||
46 | }, | ||
47 | set: function (value) { | ||
48 | this._translateZ = value; | ||
49 | this._updatePath(); | ||
50 | } | ||
51 | }, | ||
52 | |||
53 | _rotateX: { | ||
54 | enumerable: false, | ||
55 | value: null | ||
56 | }, | ||
57 | rotateX: { | ||
58 | get: function () { | ||
59 | return this._rotateX; | ||
60 | }, | ||
61 | set: function (value) { | ||
62 | this._rotateX = value; | ||
63 | this._updatePath(); | ||
64 | } | ||
65 | }, | ||
66 | |||
67 | _rotateY: { | ||
68 | enumerable: false, | ||
69 | value: null | ||
70 | }, | ||
71 | rotateY: { | ||
72 | get: function () { | ||
73 | return this._rotateY; | ||
74 | }, | ||
75 | set: function (value) { | ||
76 | this._rotateY = value; | ||
77 | this._updatePath(); | ||
78 | } | ||
79 | }, | ||
80 | |||
81 | _rotateZ: { | ||
82 | enumerable: false, | ||
83 | value: null | ||
84 | }, | ||
85 | rotateZ: { | ||
86 | get: function () { | ||
87 | return this._rotateZ; | ||
88 | }, | ||
89 | set: function (value) { | ||
90 | this._rotateZ = value; | ||
91 | this._updatePath(); | ||
92 | } | ||
93 | }, | ||
94 | |||
95 | _scale: { | ||
96 | enumerable: false, | ||
97 | value: null | ||
98 | }, | ||
99 | scale: { | ||
100 | get: function () { | ||
101 | return this._scale; | ||
102 | }, | ||
103 | set: function (value) { | ||
104 | this._scale = value; | ||
105 | this._updatePath(); | ||
106 | } | ||
107 | }, | ||
108 | |||
109 | _opacity: { | ||
110 | enumerable: false, | ||
111 | value: null | ||
112 | }, | ||
113 | opacity: { | ||
114 | get: function () { | ||
115 | return this._opacity; | ||
116 | }, | ||
117 | set: function (value) { | ||
118 | this._opacity = value; | ||
119 | this._updatePath(); | ||
120 | } | ||
121 | }, | ||
122 | |||
123 | _updatePath: { | ||
124 | enumerable: false, | ||
125 | value: function () { | ||
126 | var path = []; | ||
127 | |||
128 | if (this._translateX) { | ||
129 | path.push("path.translateX="+this._translateX); | ||
130 | } | ||
131 | if (this._translateY) { | ||
132 | path.push("path.translateY="+this._translateY); | ||
133 | } | ||
134 | if (this._translateZ) { | ||
135 | path.push("path.translateZ="+this._translateZ); | ||
136 | } | ||
137 | if (this._rotateX) { | ||
138 | path.push("path.rotateX="+this._rotateX); | ||
139 | } | ||
140 | if (this._rotateY) { | ||
141 | path.push("path.rotateY="+this._rotateY); | ||
142 | } | ||
143 | if (this._rotateZ) { | ||
144 | path.push("path.rotateZ="+this._rotateZ); | ||
145 | } | ||
146 | if (this._scale) { | ||
147 | path.push("path.scale="+this._scale); | ||
148 | } | ||
149 | if (this._opacity) { | ||
150 | path.push("path.style.opacity="+this._opacity); | ||
151 | } | ||
152 | this.evalPath=path; | ||
153 | } | ||
154 | }, | ||
155 | |||
156 | // we should be cautious with this eval, but I wanted to try serializing paths directly | ||
157 | |||
158 | _evalPath: { | ||
159 | enumerable: false, | ||
160 | value: null | ||
161 | }, | ||
162 | |||
163 | evalPath: { | ||
164 | get: function () { | ||
165 | return this._evalPath; | ||
166 | }, | ||
167 | set: function (value) { | ||
168 | var error=false; | ||
169 | |||
170 | if (typeof value === "string") { | ||
171 | try { | ||
172 | eval("var func=function(slide){var path={};path.style={};"+value+";return path;}"); | ||
173 | func({ | ||
174 | time:0, | ||
175 | speed:0, | ||
176 | index:0 | ||
177 | }); | ||
178 | } catch (e) { | ||
179 | error=true; | ||
180 | } | ||
181 | if (!error) { | ||
182 | this._evalPath = value; | ||
183 | } | ||
184 | } else { | ||
185 | this._evalPath = value.join(";\r\n")+";"; | ||
186 | eval("var func=function(slide){var path={};path.style={};"+this._evalPath+"return path;}"); | ||
187 | } | ||
188 | |||
189 | if (!error) { | ||
190 | this.path = { | ||
191 | value: func | ||
192 | }; | ||
193 | } | ||
194 | } | ||
195 | }, | ||
196 | |||
197 | _path: { | ||
198 | enumerable: false, | ||
199 | value: { | ||
200 | value: function (slide) { | ||
201 | return {}; | ||
202 | } | ||
203 | } | ||
204 | }, | ||
205 | |||
206 | path: { | ||
207 | get: function () { | ||
208 | return this._path; | ||
209 | }, | ||
210 | set: function (value) { | ||
211 | this._path = value; | ||
212 | } | ||
213 | } | ||
214 | |||
215 | }); | ||