diff options
author | Jose Antonio Marquez | 2012-02-02 18:00:45 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-02 18:00:45 -0800 |
commit | 04d89daed90c35a4393773ca2e2d0ac3a4c15cd4 (patch) | |
tree | d0041abc7379ef38b20cce148e5dea6f531b8569 /node_modules/montage/ui/flow.reel/flow.js | |
parent | 4d8306b638c53899403a4f0328c02bf1ab893e8f (diff) | |
parent | c630ead20487c3948fa36448d3e7d5f7b5cba782 (diff) | |
download | ninja-04d89daed90c35a4393773ca2e2d0ac3a4c15cd4.tar.gz |
Merge branch 'refs/heads/NinjaInternal' into FileIO
Conflicts:
.gitignore
js/ninja.reel/ninja.js
Diffstat (limited to 'node_modules/montage/ui/flow.reel/flow.js')
-rwxr-xr-x | node_modules/montage/ui/flow.reel/flow.js | 658 |
1 files changed, 536 insertions, 122 deletions
diff --git a/node_modules/montage/ui/flow.reel/flow.js b/node_modules/montage/ui/flow.reel/flow.js index c0a6b32f..21556e41 100755 --- a/node_modules/montage/ui/flow.reel/flow.js +++ b/node_modules/montage/ui/flow.reel/flow.js | |||
@@ -1,18 +1,90 @@ | |||
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, | 1 | var Montage = require("montage").Montage, |
8 | Component = require("ui/component").Component; | 2 | Component = require("ui/component").Component; |
9 | 3 | ||
10 | var Flow = exports.Flow = Montage.create(Component, { | 4 | var Flow = exports.Flow = Montage.create(Component, { |
11 | 5 | ||
6 | // TODO: Review _externalUpdate | ||
7 | |||
8 | _externalUpdate: { | ||
9 | enumerable: false, | ||
10 | value: true | ||
11 | }, | ||
12 | |||
13 | _isCameraUpdated: { | ||
14 | enumerable: false, | ||
15 | value: false | ||
16 | }, | ||
17 | |||
18 | // Camera rotation based in CSS3 rotate3D axis/angle system | ||
19 | |||
20 | _cameraRotationAxisX: { | ||
21 | enumerable: false, | ||
22 | value: 0 | ||
23 | }, | ||
24 | |||
25 | _cameraRotationAxisY: { | ||
26 | enumerable: false, | ||
27 | value: 0 | ||
28 | }, | ||
29 | |||
30 | _cameraRotationAxisZ: { | ||
31 | enumerable: false, | ||
32 | value: 1 | ||
33 | }, | ||
34 | |||
35 | _cameraRotationAngle: { | ||
36 | enumerable: false, | ||
37 | value: 0 | ||
38 | }, | ||
39 | |||
40 | cameraRotationAxisX: { | ||
41 | get: function () { | ||
42 | return this._cameraRotationAxisX; | ||
43 | }, | ||
44 | set: function (value) { | ||
45 | this._cameraRotationAxisX = value; | ||
46 | this._isCameraUpdated = true; | ||
47 | this.needsDraw = true; | ||
48 | } | ||
49 | }, | ||
50 | |||
51 | cameraRotationAxisY: { | ||
52 | get: function () { | ||
53 | return this._cameraRotationAxisY; | ||
54 | }, | ||
55 | set: function (value) { | ||
56 | this._cameraRotationAxisY = value; | ||
57 | this._isCameraUpdated = true; | ||
58 | this.needsDraw = true; | ||
59 | } | ||
60 | }, | ||
61 | |||
62 | cameraRotationAxisZ: { | ||
63 | get: function () { | ||
64 | return this._cameraRotationAxisZ; | ||
65 | }, | ||
66 | set: function (value) { | ||
67 | this._cameraRotationAxisZ = value; | ||
68 | this._isCameraUpdated = true; | ||
69 | this.needsDraw = true; | ||
70 | } | ||
71 | }, | ||
72 | |||
73 | cameraRotationAngle: { | ||
74 | get: function () { | ||
75 | return this._cameraRotationAngle; | ||
76 | }, | ||
77 | set: function (value) { | ||
78 | this._cameraRotationAngle = value; | ||
79 | this._isCameraUpdated = true; | ||
80 | this.needsDraw = true; | ||
81 | } | ||
82 | }, | ||
83 | |||
12 | _path: { | 84 | _path: { |
13 | enumerable: false, | 85 | enumerable: false, |
14 | value: { | 86 | value: { |
15 | value: function (slide) { | 87 | value: function (slide) { |
16 | return { | 88 | return { |
17 | translateX: slide.time, | 89 | translateX: slide.time, |
18 | translateY: 0, | 90 | translateY: 0, |
@@ -29,7 +101,7 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
29 | } | 101 | } |
30 | } | 102 | } |
31 | }, | 103 | }, |
32 | 104 | ||
33 | path: { | 105 | path: { |
34 | get: function () { | 106 | get: function () { |
35 | return this._path; | 107 | return this._path; |
@@ -39,12 +111,12 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
39 | this.needsDraw = true; | 111 | this.needsDraw = true; |
40 | } | 112 | } |
41 | }, | 113 | }, |
42 | 114 | ||
43 | _rotationOrder: { | 115 | _rotationOrder: { |
44 | enumerable: false, | 116 | enumerable: false, |
45 | value: "xyz" | 117 | value: "xyz" |
46 | }, | 118 | }, |
47 | 119 | ||
48 | rotationOrder: { | 120 | rotationOrder: { |
49 | get: function () { | 121 | get: function () { |
50 | return this._rotationOrder; | 122 | return this._rotationOrder; |
@@ -55,7 +127,7 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
55 | case "yxz": | 127 | case "yxz": |
56 | case "yzx": | 128 | case "yzx": |
57 | case "zxy": | 129 | case "zxy": |
58 | case "zyx": | 130 | case "zyx": |
59 | this._rotationOrder=value; | 131 | this._rotationOrder=value; |
60 | break; | 132 | break; |
61 | default: | 133 | default: |
@@ -65,33 +137,7 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
65 | this.needsDraw = true; | 137 | this.needsDraw = true; |
66 | } | 138 | } |
67 | }, | 139 | }, |
68 | 140 | ||
69 | numberOfNodes: { | ||
70 | value: null | ||
71 | }, | ||
72 | |||
73 | _nodeOffset: { | ||
74 | enumerable: false, | ||
75 | value: { | ||
76 | value: function (nodeNumber) { | ||
77 | return { | ||
78 | time: nodeNumber*100, | ||
79 | speed: 0 | ||
80 | } | ||
81 | } | ||
82 | } | ||
83 | }, | ||
84 | |||
85 | nodeOffset: { | ||
86 | get: function () { | ||
87 | return this._nodeOffset; | ||
88 | }, | ||
89 | set: function (value) { | ||
90 | this._nodeOffset = value; | ||
91 | this.needsDraw = true; | ||
92 | } | ||
93 | }, | ||
94 | |||
95 | _width: { | 141 | _width: { |
96 | enumerable: false, | 142 | enumerable: false, |
97 | value: null | 143 | value: null |
@@ -101,19 +147,19 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
101 | enumerable: false, | 147 | enumerable: false, |
102 | value: null | 148 | value: null |
103 | }, | 149 | }, |
104 | 150 | ||
105 | _repetitionComponents: { | 151 | _repetitionComponents: { |
106 | enumerable: false, | 152 | enumerable: false, |
107 | value: null | 153 | value: null |
108 | }, | 154 | }, |
109 | 155 | ||
110 | prepareForDraw: { | 156 | prepareForDraw: { |
111 | enumerable: false, | 157 | enumerable: false, |
112 | value: function () { | 158 | value: function () { |
113 | this._repetitionComponents=this._repetition._childComponents; | 159 | this._repetitionComponents = this._repetition._childComponents; |
114 | } | 160 | } |
115 | }, | 161 | }, |
116 | 162 | ||
117 | draw: { | 163 | draw: { |
118 | enumerable: false, | 164 | enumerable: false, |
119 | value: function () { | 165 | value: function () { |
@@ -131,87 +177,96 @@ var Flow = exports.Flow = Montage.create(Component, { | |||
131 | jPath, | 177 | jPath, |
132 | iOffset, | 178 | iOffset, |
133 | iStyle; | 179 | iStyle; |
134 | 180 | ||
135 | for (i=0; i<length; i++) { | 181 | if (this.isAnimating) { |
136 | iStyle=this._repetitionComponents[i].element.style; | 182 | this._animationInterval(); |
137 | iOffset=this._nodeOffset.value(i); | 183 | } |
138 | slide.index=i; | 184 | if (this._isCameraUpdated) { |
139 | slide.time=iOffset.time; | 185 | this._repetition._element.style.webkitTransform = "rotate3d("+this._cameraRotati |