Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Side by Side Diff: chrome/test/data/third_party/spaceport/js/sprites/Transform.js

Issue 10134041: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 });
OLDNEW
« no previous file with comments | « chrome/test/data/third_party/spaceport/js/index.js ('k') | chrome/test/data/third_party/spaceport/js/sprites/canvas.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698