|
22 | 22 | * rendering. This eases a lot of cases where it might be pretty complex to break down a state
|
23 | 23 | * based on the pure time difference.
|
24 | 24 | */
|
| 25 | +var zyngaCore = { effect: {} }; |
25 | 26 | (function(global) {
|
26 | 27 | var time = Date.now || function() {
|
27 | 28 | return +new Date();
|
|
31 | 32 | var running = {};
|
32 | 33 | var counter = 1;
|
33 | 34 |
|
34 |
| - // Create namespaces |
35 |
| - if (!global.core) { |
36 |
| - var core = global.core = { effect : {} }; |
37 |
| - |
38 |
| - } else if (!core.effect) { |
39 |
| - core.effect = {}; |
40 |
| - } |
41 |
| - |
42 |
| - core.effect.Animate = { |
| 35 | + zyngaCore.effect.Animate = { |
43 | 36 |
|
44 | 37 | /**
|
45 | 38 | * A requestAnimationFrame wrapper / polyfill.
|
|
221 | 214 | completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null);
|
222 | 215 | } else if (render) {
|
223 | 216 | lastFrame = now;
|
224 |
| - core.effect.Animate.requestAnimationFrame(step, root); |
| 217 | + zyngaCore.effect.Animate.requestAnimationFrame(step, root); |
225 | 218 | }
|
226 | 219 | };
|
227 | 220 |
|
228 | 221 | // Mark as running
|
229 | 222 | running[id] = true;
|
230 | 223 |
|
231 | 224 | // Init first step
|
232 |
| - core.effect.Animate.requestAnimationFrame(step, root); |
| 225 | + zyngaCore.effect.Animate.requestAnimationFrame(step, root); |
233 | 226 |
|
234 | 227 | // Return unique animation ID
|
235 | 228 | return id;
|
@@ -1274,7 +1267,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
1274 | 1267 |
|
1275 | 1268 | // Stop deceleration
|
1276 | 1269 | if (self.__isDecelerating) {
|
1277 |
| - core.effect.Animate.stop(self.__isDecelerating); |
| 1270 | + zyngaCore.effect.Animate.stop(self.__isDecelerating); |
1278 | 1271 | self.__isDecelerating = false;
|
1279 | 1272 | }
|
1280 | 1273 |
|
@@ -1349,7 +1342,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
1349 | 1342 |
|
1350 | 1343 | // Stop deceleration
|
1351 | 1344 | if (self.__isDecelerating) {
|
1352 |
| - core.effect.Animate.stop(self.__isDecelerating); |
| 1345 | + zyngaCore.effect.Animate.stop(self.__isDecelerating); |
1353 | 1346 | self.__isDecelerating = false;
|
1354 | 1347 | }
|
1355 | 1348 |
|
@@ -1481,14 +1474,14 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
1481 | 1474 |
|
1482 | 1475 | // Stop deceleration
|
1483 | 1476 | if (self.__isDecelerating) {
|
1484 |
| - core.effect.Animate.stop(self.__isDecelerating); |
| 1477 | + zyngaCore.effect.Animate.stop(self.__isDecelerating); |
1485 | 1478 | self.__isDecelerating = false;
|
1486 | 1479 | self.__interruptedAnimation = true;
|
1487 | 1480 | }
|
1488 | 1481 |
|
1489 | 1482 | // Stop animation
|
1490 | 1483 | if (self.__isAnimating) {
|
1491 |
| - core.effect.Animate.stop(self.__isAnimating); |
| 1484 | + zyngaCore.effect.Animate.stop(self.__isAnimating); |
1492 | 1485 | self.__isAnimating = false;
|
1493 | 1486 | self.__interruptedAnimation = true;
|
1494 | 1487 | }
|
@@ -1871,7 +1864,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
1871 | 1864 | // Remember whether we had an animation, then we try to continue based on the current "drive" of the animation
|
1872 | 1865 | var wasAnimating = self.__isAnimating;
|
1873 | 1866 | if (wasAnimating) {
|
1874 |
| - core.effect.Animate.stop(wasAnimating); |
| 1867 | + zyngaCore.effect.Animate.stop(wasAnimating); |
1875 | 1868 | self.__isAnimating = false;
|
1876 | 1869 | }
|
1877 | 1870 |
|
@@ -1924,7 +1917,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
1924 | 1917 | };
|
1925 | 1918 |
|
1926 | 1919 | // When continuing based on previous animation we choose an ease-out animation instead of ease-in-out
|
1927 |
| - self.__isAnimating = core.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic); |
| 1920 | + self.__isAnimating = zyngaCore.effect.Animate.start(step, verify, completed, self.options.animationDuration, wasAnimating ? easeOutCubic : easeInOutCubic); |
1928 | 1921 |
|
1929 | 1922 | } else {
|
1930 | 1923 |
|
@@ -2056,7 +2049,7 @@ ionic.views.Scroll = ionic.views.View.inherit({
|
2056 | 2049 | };
|
2057 | 2050 |
|
2058 | 2051 | // Start animation and switch on flag
|
2059 |
| - self.__isDecelerating = core.effect.Animate.start(step, verify, completed); |
| 2052 | + self.__isDecelerating = zyngaCore.effect.Animate.start(step, verify, completed); |
2060 | 2053 |
|
2061 | 2054 | },
|
2062 | 2055 |
|
|
0 commit comments