aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js')
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js418
1 files changed, 418 insertions, 0 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 175b77f9..925d4a9d 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -15,7 +15,425 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
15 15
16 prepareForDraw:{ 16 prepareForDraw:{
17 value:function(){ 17 value:function(){
18 this.element.addEventListener("click", this, false);
19 this.trackID = this.parentComponent.parentComponent.parentComponent.trackID;
20 this.animatedElement = this.parentComponent.parentComponent.parentComponent.animatedElement;
21 this.ninjaStylesContoller = this.application.ninja.stylesController;
22 }
23 },
24
25 draw:{
26 value:function(){
27
28 }
29 },
30
31 didDraw:{
32 value:function () {
33 if(this.currentKeyframeRule){
34 this.retrieveStoredStyleTweens();
35 }
36 }
37 },
38
39 trackEditorProperty:{
40 value:""
41 },
42
43 _propTweenRepetition:{
44 value:null
45 },
46
47 animatedElement:{
48 value:null
49 },
50
51 isSubproperty:{
52 value:true
53 },
54
55 propTweenRepetition:{
56 serializable:true,
57 get:function () {
58 return this._propTweenRepetition;
59 },
60 set:function (newVal) {
61 this._propTweenRepetition = newVal;
62 }
63 },
64
65 _propTweens:{
66 value:[]
67 },
68
69 propTweens:{
70 serializable:true,
71 get:function () {
72 return this._propTweens;
73 },
74 set:function (newVal) {
75 this._propTweens = newVal;
76 }
77 },
78
79 _propTrackData:{
80 value:false
81 },
82
83 propTrackData:{
84 serializable:true,
85 get:function () {
86 return this._propTrackData;
87 },
88 set:function (val) {
89 this._propTrackData = val;
90 if (this._propTrackData) {
91 this.setData();
92 }
93 }
94 },
95
96 nextKeyframe:{
97 value:1
98 },
99
100 ninjaStylesContoller:{
101 value:null
102 },
103
104 animationName:{
105 value:null
106 },
107
108 currentKeyframeRule:{
109 value:null
110 },
111
112 trackDuration:{
113 value:0
114 },
115
116 _trackID:{
117 value:null
118 },
119
120 trackID:{
121 serializable:true,
122 get:function () {
123 return this._trackID;
124 },
125 set:function (value) {
126 if (value !== this._trackID) {
127 this._trackID = value;
128 }
129 }
130 },
131
132 _trackType:{
133 value:null
134 },
135
136 trackType:{
137 serializable:true,
138 get:function () {
139 return this._trackType;
140 },
141 set:function (value) {
142 if (value !== this._trackType) {
143 this._trackType = value;
144 }
145 }
146 },
147
148 _styleIndex:{
149 value:null
150 },
151
152 styleIndex:{
153 serializable:true,
154 get:function () {
155 return this._styleIndex;
156 },
157 set:function (value) {
158 if (value !== this._styleIndex) {
159 this._styleIndex = value;
160 }
161 }
162 },
163
164 setData:{
165 value:function () {
166 if (typeof(this.propTrackData) === "undefined") {
167 return;
168 }
169
170 this.styleIndex = this.propTrackData.styleIndex;
171 this.propTweens = this.propTrackData.propTweens;
172 this.trackType = this.propTrackData.trackType;
173 this.trackEditorProperty = this.propTrackData.trackEditorProperty;
174 this.currentKeyframeRule = this.propTrackData.existingRule;
175 this.needsDraw = true;
176 }
177 },
178
179 handleClick:{
180 value:function (ev) {
181 if (ev.shiftKey) {
182
183 if (this.trackType == "position") {
184 this.parentComponent.parentComponent.parentComponent.handleNewTween(ev);
185 }
186
187 if (this.propTweens.length < 1) {
188
189 // check if there is an editor property assigned yet
190 // get this property track's editor prop name from layer data arrays
191 var selectIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
192
193 if (this.trackType == "style") {
194 if (this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty == null) {
195 console.log("Please enter a style property for this track before adding keyframes.");
196 return;
197 } else {
198 this.trackEditorProperty = this.application.ninja.timeline.arrLayers[selectIndex].layerData.arrLayerStyles[this.styleIndex].editorProperty;
199 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
200 }
201 } else if (this.trackType == "position") {
202 //console.log("Property track editorProperty set to: " + this.trackEditorProperty);
203 }
204
205 this.insertPropTween(0);
206 this.addPropAnimationRuleToElement(ev);
207 this.updatePropKeyframeRule();
208 } else {
209 this.handleNewPropTween(ev);
210 this.updatePropKeyframeRule();
211 }
212 }
213 }
214 },
215
216 handleNewPropTween:{
217 value:function(ev){
218 if (ev.offsetX > this.propTweens[this.propTweens.length - 1].tweenData.keyFramePosition) {
219 this.insertPropTween(ev.offsetX);
220 } else {
221 console.log("Splitting style tweens not yet supported.");
222 }
223 }
224 },
225
226 insertPropTween:{
227 value:function(clickPos){
228 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
229 this.application.ninja.timeline.selectLayer(selectedIndex, true);
230
231 var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
232 var currentMillisec = currentMillisecPerPixel * clickPos;
233</