var Montage = require("montage").Montage, Component = require("ui/component").Component; var Flow = exports.Flow = Montage.create(Component, { // TODO: Review _externalUpdate _externalUpdate: { enumerable: false, value: true }, _isCameraUpdated: { enumerable: false, value: false }, // Camera rotation based in CSS3 rotate3D axis/angle system _cameraRotationAxisX: { enumerable: false, value: 0 }, _cameraRotationAxisY: { enumerable: false, value: 0 }, _cameraRotationAxisZ: { enumerable: false, value: 1 }, _cameraRotationAngle: { enumerable: false, value: 0 }, cameraRotationAxisX: { get: function () { return this._cameraRotationAxisX; }, set: function (value) { this._cameraRotationAxisX = value; this._isCameraUpdated = true; this.needsDraw = true; } }, cameraRotationAxisY: { get: function () { return this._cameraRotationAxisY; }, set: function (value) { this._cameraRotationAxisY = value; this._isCameraUpdated = true; this.needsDraw = true; } }, cameraRotationAxisZ: { get: function () { return this._cameraRotationAxisZ; }, set: function (value) { this._cameraRotationAxisZ = value; this._isCameraUpdated = true; this.needsDraw = true; } }, cameraRotationAngle: { get: function () { return this._cameraRotationAngle; }, set: function (value) { this._cameraRotationAngle = value; this._isCameraUpdated = true; this.needsDraw = true; } }, _path: { enumerable: false, value: { value: function (slide) { return { translateX: slide.time, translateY: 0, translateZ: 0, scale: 1, rotateX: 0, rotateY: 0, rotateZ: 0, transformOriginX: 0, transformOriginY: 0, transformOriginZ: 0, style: {} }; } } }, path: { get: function () { return this._path; }, set: function (value) { this._path = value; this.needsDraw = true; } }, _rotationOrder: { enumerable: false, value: "xyz" }, rotationOrder: { get: function () { return this._rotationOrder; }, set: function (value) { switch (value) { case "xzy": case "yxz": case "yzx": case "zxy": case "zyx": this._rotationOrder=value; break; default: this._rotationOrder="xyz"; break; } this.needsDraw = true; } }, _width: { enumerable: false, value: null }, _height: { enumerable: false, value: null }, _repetitionComponents: { enumerable: false, value: null }, prepareForDraw: { enumerable: false, value: function () { this._repetitionComponents = this._repetition._childComponents; } }, draw: { enumerable: false, value: function () { var i, length = this.numberOfNodes, slide={ index: null, time: null, speed: null }, transform, origin, iPath, j, jPath, iOffset, iStyle; if (this.isAnimating) { this._animationInterval(); } if (this._isCameraUpdated) { this._repetition._element.style.webkitTransform = "rotate3d("+this._cameraRotationAxisX+","+this._cameraRotationAxisY+","+this._cameraRotationAxisZ+","+this._cameraRotationAngle+"rad)"; this._isCameraUpdated = false; } //if (this._externalUpdate) { for (i=0; ii*this._scale) { this.startAnimating(i, x); } } } } this.stopAnimating(this._selectedSlideIndex); if (!this.isAnimating) { this._animationInterval=function () { var animatingLength=self.animating.length, n, j, i, _iterations=8, time=Date.now(), interval1=self.lastDrawTime?(time-self.lastDrawTime)*0.015*this._elasticScrollingSpeed:0, interval=interval1/_iterations, mW=self._scale, x, epsilon=.5; for (n=0; n<_iterations; n++) { for (j=0; ji*self._scale-epsilon) { self.stopAnimating(i); animatingLength--; } else { j++; } } else { if (self.slide[i].x