diff options
author | Kruti Shah | 2012-05-31 10:44:45 -0700 |
---|---|---|
committer | Kruti Shah | 2012-05-31 10:44:45 -0700 |
commit | c350cc1c060fdf17357ddadce024267943784593 (patch) | |
tree | 453f86e88f1ee1dfda6fb4b7cc7b17e306e39536 /js/panels/Timeline/PropertyTrack.reel | |
parent | fdc4f5c7f81ae3b9adeca2232e60268b4be594a2 (diff) | |
parent | 121d0e616f48aa7cd048763554089c20a1883d7a (diff) | |
download | ninja-c350cc1c060fdf17357ddadce024267943784593.tar.gz |
Merge branch 'refs/heads/TimelineUberjd' into TimelineUber
Conflicts:
js/panels/Timeline/Layer.reel/Layer.js
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
Diffstat (limited to 'js/panels/Timeline/PropertyTrack.reel')
-rw-r--r-- | js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js index fbc3edd0..1e495402 100644 --- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js +++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js | |||
@@ -31,11 +31,11 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
31 | didDraw:{ | 31 | didDraw:{ |
32 | value:function () { | 32 | value:function () { |
33 | if ((!this.application.ninja.documentController.creatingNewFile) || (!this.application.ninja.currentDocument.setLevel)) { | 33 | if ((!this.application.ninja.documentController.creatingNewFile) || (!this.application.ninja.currentDocument.setLevel)) { |
34 | if (this.application.ninja.currentDocument.documentRoot.children[0]) { | 34 | if (this.application.ninja.currentDocument.model.documentRoot.children[0]) { |
35 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); | 35 | var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); |
36 | if (selectedIndex !== false) { | 36 | if (selectedIndex !== false) { |
37 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { | 37 | if (!this.application.ninja.timeline.arrLayers[selectedIndex].layerData.created) { |
38 | //this.retrieveStoredStyleTweens(); | 38 | this.retrieveStoredStyleTweens(); |
39 | } | 39 | } |
40 | } | 40 | } |
41 | } | 41 | } |
@@ -240,6 +240,14 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
240 | 240 | ||
241 | var newTween = {}; | 241 | var newTween = {}; |
242 | newTween.tweenData = {}; | 242 | newTween.tweenData = {}; |
243 | newTween.tweenData.tweenedProperties = []; | ||
244 | |||
245 | // TODO - check for color values vs px values and set the correct default | ||
246 | var propVal = this.ninjaStylesContoller.getElementStyle(this.animatedElement, this.trackEditorProperty); | ||
247 | if(propVal == null){ | ||
248 | propVal = "1px"; | ||
249 | } | ||
250 | newTween.tweenData.tweenedProperties[this.trackEditorProperty] = propVal; | ||
243 | 251 | ||
244 | if (clickPos == 0) { | 252 | if (clickPos == 0) { |
245 | newTween.tweenData.spanWidth = 0; | 253 | newTween.tweenData.spanWidth = 0; |
@@ -247,8 +255,6 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
247 | newTween.tweenData.keyFrameMillisec = 0; | 255 | newTween.tweenData.keyFrameMillisec = 0; |
248 | newTween.tweenData.tweenID = 0; | 256 | newTween.tweenData.tweenID = 0; |
249 | newTween.tweenData.spanPosition = 0; | 257 | newTween.tweenData.spanPosition = 0; |
250 | newTween.tweenData.tweenedProperties = []; | ||
251 | newTween.tweenData.tweenedProperties[this.trackEditorProperty] = this.ninjaStylesContoller.getElementStyle(this.animatedElement, this.trackEditorProperty); | ||
252 | 258 | ||
253 | this.propTweens.push(newTween); | 259 | this.propTweens.push(newTween); |
254 | 260 | ||
@@ -258,8 +264,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
258 | newTween.tweenData.keyFrameMillisec = currentMillisec; | 264 | newTween.tweenData.keyFrameMillisec = currentMillisec; |
259 | newTween.tweenData.tweenID = this.nextKeyframe; | 265 | newTween.tweenData.tweenID = this.nextKeyframe; |
260 | newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; | 266 | newTween.tweenData.spanPosition = clickPos - newTween.tweenData.spanWidth; |
261 | newTween.tweenData.tweenedProperties = []; | 267 | |
262 | newTween.tweenData.tweenedProperties[this.trackEditorProperty] = this.ninjaStylesContoller.getElementStyle(this.animatedElement, this.trackEditorProperty); | ||
263 | this.propTweens.push(newTween); | 268 | this.propTweens.push(newTween); |
264 | 269 | ||
265 | this.nextKeyframe += 1; | 270 | this.nextKeyframe += 1; |
@@ -344,27 +349,31 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, { | |||
344 | addPropAnimationRuleToElement:{ | 349 | addPropAnimationRuleToElement:{ |
345 | value:function(tweenEvent){ | 350 | value:function(tweenEvent){ |
346 | var currentStyleValue = this.ninjaStylesContoller.getElementStyle(this.animatedElement, this.trackEditorProperty); | 351 | var currentStyleValue = this.ninjaStylesContoller.getElementStyle(this.animatedElement, this.trackEditorProperty); |
352 | if (currentStyleValue == null) { | ||
353 | currentStyleValue = "1px"; | ||
354 | } | ||
355 | console.log(currentStyleValue); | ||
356 | |||
347 | this.propTweens[0].tweenData.tweenedProperties[this.trackEditorProperty] = currentStyleValue; | 357 | this.propTweens[0].tweenData.tweenedProperties[this.trackEditorProperty] = currentStyleValue; |
348 | 358 | ||
359 | |||
349 | this.animationName = this.animatedElement.classList[0] + "_" + this.trackEditorProperty; | 360 | this.animationName = this.animatedElement.classList[0] + "_" + this.trackEditorProperty; |
350 | var currentAnimationNameString = this.parentComponent.parentComponent.parentComponent.animationNamesString; | 361 | var currentAnimationNameString = this.parentComponent.parentComponent.parentComponent.animationNamesString; |
351 | var newAnimationNames = currentAnimationNameString + "," + this.animationName; | 362 | var newAnimationNames = currentAnimationNameString + "," + this.animationName; |
352 | //var currentAnimationDuration = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-duration"); | 363 | var currentAnimationDuration = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-duration"); |
353 | //var newAnimationDuration = currentAnimationDuration + "," + currentAnimationDuration; | 364 | var newAnimationDuration = currentAnimationDuration + "," + currentAnimationDuration; |
354 | //var currentIterationCount = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-iteration-count"); | 365 | var currentIterationCount = this.ninjaStylesContoller.getElementStyle(this.animatedElement, "-webkit-animation-iteration-count"); |
355 | //var newIterationCount = currentIterationCount + ",1"; | 366 | var newIterationCount = currentIterationCount + ",1"; |
356 | 367 | ||
357 | this.parentComponent.parentComponent.parentComponent.animationNamesString = newAnimationNames; | 368 | this.parentComponent.parentComponent.parentComponent.animationNamesString = newAnimationNames; |
358 | 369 | ||
359 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", newAnimationNames); | 370 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-name", newAnimationNames); |
360 | 371 | ||
361 | //this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", newAnimationDuration); | 372 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-duration", newAnimationDuration); |
362 | //this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", newIterationCount); | 373 | this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-iteration-count", newIterationCount); |
363 | //this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-animation-fill-mode", "both"); | ||
364 | //this.ninjaStylesContoller.setElementStyle(this.animatedElement, "-webkit-transition-timing-function", "linear"); | ||
365 | 374 | ||
366 | var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} 100% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} }"; | 375 | var initRule = "@-webkit-keyframes " + this.animationName + " { 0% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} 100% {" + this.trackEditorProperty + ": " + currentStyleValue + ";} }"; |
367 | //console.log(initRule); | 376 | console.log(initRule); |
368 | this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule); | 377 | this.currentKeyframeRule = this.ninjaStylesContoller.addRule(initRule); |
369 | 378 | ||
370 | this.insertPropTween(tweenEvent.offsetX); | 379 | this.insertPropTween(tweenEvent.offsetX); |