diff options
author | Jonathan Duran | 2012-05-03 23:09:48 -0700 |
---|---|---|
committer | Jonathan Duran | 2012-05-03 23:09:48 -0700 |
commit | 54fd77320dcce93987c138923bcb8a9b9899c4c0 (patch) | |
tree | f9fd14935c1749a10f37476d55605f43776499e2 /js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | |
parent | fec9ccee11ea21ffc95edce6e89d0d302b63e3d8 (diff) | |
download | ninja-54fd77320dcce93987c138923bcb8a9b9899c4c0.tar.gz |
apply old stash to new branch
initial work and stubs for sub property support. serialization for property track components and classes
Signed-off-by: Jonathan Duran <jduran@motorola.com>
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js')
-rw-r--r-- | js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index 175b77f9..8f7745e5 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | |||
@@ -15,6 +15,119 @@ 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 | } | ||
20 | }, | ||
21 | |||
22 | draw:{ | ||
23 | value:function(){ | ||
24 | |||
25 | } | ||
26 | }, | ||
27 | |||
28 | _propTweenRepetition:{ | ||
29 | value:null | ||
30 | }, | ||
31 | |||
32 | propTweenRepetition:{ | ||
33 | serializable:true, | ||
34 | get:function () { | ||
35 | return this._propTweenRepetition; | ||
36 | }, | ||
37 | set:function (newVal) { | ||
38 | this._propTweenRepetition = newVal; | ||
39 | } | ||
40 | }, | ||
41 | |||
42 | _propTweens:{ | ||
43 | value:[] | ||
44 | }, | ||
45 | |||
46 | propTweens:{ | ||
47 | serializable:true, | ||
48 | get:function () { | ||
49 | return this._propTweens; | ||
50 | }, | ||
51 | set:function (newVal) { | ||
52 | this._propTweens = newVal; | ||
53 | } | ||
54 | }, | ||
55 | |||
56 | nextKeyframe:{ | ||
57 | value:1 | ||
58 | }, | ||
59 | |||
60 | handleClick:{ | ||
61 | value:function(ev){ | ||
62 | var parentTrackID = this.parentComponent.parentComponent.parentComponent.trackID; | ||
63 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(parentTrackID); | ||
64 | //console.log(this.application.ninja.timeline.arrLayers[selectedIndex].layerData); | ||
65 | this.application.ninja.timeline.selectLayer(selectedIndex, true); | ||
66 | |||
67 | if (ev.shiftKey) { | ||
68 | if (this.propTweens.length < 1) { | ||
69 | this.insertPropTween(0); | ||
70 | this.addPropAnimationRuleToElement(ev); | ||
71 | this.updatePropKeyframeRule(); | ||
72 | } else { | ||
73 | this.handleNewPropTween(ev); | ||
74 | this.updatePropKeyframeRule(); | ||
75 | } | ||
76 | } | ||
77 | } | ||
78 | }, | ||
79 | |||
80 | handleNewPropTween:{ | ||
81 | value:function(ev){ | ||
82 | this.insertPropTween(ev.offsetX); | ||
83 | } | ||
84 | }, | ||
85 | |||
86 | insertPropTween:{ | ||
87 | value:function(clickPos){ | ||
88 | var currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); | ||
89 | var currentMillisec = currentMillisecPerPixel * clickPos; | ||
90 | |||
91 | var newTween = {}; | ||
92 | newTween.tweenData = {}; | ||
93 | |||
94 | if (clickPos == 0) { | ||
95 | newTween.tweenData.spanWidth = 0; | ||
96 | newTween.tweenData.keyFramePosition = 0; | ||
97 | newTween.tweenData.keyFrameMillisec = 0; | ||
98 | newTween.tweenData.tweenID = 0; | ||
99 | newTween.tweenData.spanPosition = 0; | ||
100 | newTween.tweenData.tweenedProperties = []; | ||
101 | |||
102 | this.propTweens.push(newTween); | ||
103 | |||
104 | } else { | ||
105 | newTween.tweenData.spanWidth = clickPos - this.propTweens[this.propTweens.length - 1].tweenData.keyFramePosition; | ||
106 | newTween.tweenData.keyFramePosition = clickPos; | ||
107 | newTween.tweenData.keyFrameMillisec = currentMillisec; | ||
108 | newTween.tweenData.tweenID = this.nextKeyframe; | ||
109 | newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; | ||
110 | newTween.tweenData.tweenedProperties = []; | ||
111 | |||
112 | this.propTweens.push(newTween); | ||
113 | |||
114 | this.nextKeyframe += 1; | ||
115 | } | ||
116 | |||
117 | this.application.ninja.documentController.activeDocument.needsSave = true; | ||
118 | } | ||
119 | }, | ||
120 | |||
121 | updatePropKeyframeRule:{ | ||
122 | value:function(){ | ||
123 | |||
124 | } | ||
125 | }, | ||
126 | |||
127 | addPropAnimationRuleToElement:{ | ||
128 | value:function(tweenEvent){ | ||
129 | console.log("SECOND PROP TWEEN ADDING at " + tweenEvent.offsetX); | ||
130 | this.insertPropTween(tweenEvent.offsetX); | ||
18 | 131 | ||
19 | } | 132 | } |
20 | } | 133 | } |