| OLD | NEW |
| (Empty) | |
| 1 define([ ], function () { |
| 2 function Transform(options) { |
| 3 this.x = 0; |
| 4 this.y = 0; |
| 5 this.scaleX = 1; |
| 6 this.scaleY = 1; |
| 7 this.rotation = 0; |
| 8 |
| 9 'x,y,scaleX,scaleY,rotation'.split(',').forEach(function (prop) { |
| 10 if (prop in options) { |
| 11 this[prop] = options[prop]; |
| 12 } |
| 13 }, this); |
| 14 |
| 15 // Matrix <=> array index representation: |
| 16 // [ 0 1 2 ] |
| 17 // [ 3 4 5 ] |
| 18 // [ - - - ] |
| 19 var cos = Math.cos(this.rotation); |
| 20 var sin = Math.sin(this.rotation); |
| 21 this.matrix = [ |
| 22 cos * this.scaleX, -sin, this.x, |
| 23 sin, cos * this.scaleY, this.y |
| 24 ]; |
| 25 |
| 26 this.cssTransform2d = '' + |
| 27 'translate(' + this.x + 'px,' + this.y + 'px) ' + |
| 28 'scale(' + this.scaleX + ',' + this.scaleY + ') ' + |
| 29 'rotate(' + this.rotation + 'rad) ' + |
| 30 ''; |
| 31 |
| 32 this.cssTransform3d = '' + |
| 33 'translate3D(' + this.x + 'px,' + this.y + 'px,0px) ' + |
| 34 'scale3D(' + this.scaleX + ',' + this.scaleY + ',1) ' + |
| 35 'rotate(' + this.rotation + 'rad) ' + |
| 36 ''; |
| 37 } |
| 38 |
| 39 return Transform; |
| 40 }); |
| OLD | NEW |