Get rid of options member variable in Benchmark.
[WebKit-https.git] / PerformanceTests / Animometer / tests / bouncing-particles / resources / bouncing-css-images.js
1 (function() {
2
3 BouncingCssImage = Utilities.createSubclass(BouncingParticle,
4     function(stage)
5     {
6         BouncingParticle.call(this, stage);
7
8         this.element = document.createElement("img");
9         this.element.style.width = this.size.x + "px";
10         this.element.style.height = this.size.y + "px";
11         this.element.setAttribute("src", stage.imageSrc);
12
13         stage.element.appendChild(this.element);
14         this._move();
15     }, {
16
17     _move: function()
18     {
19         this.element.style.transform = "translate(" + this.position.x + "px," + this.position.y + "px) " + this.rotater.rotateZ();
20     },
21
22     animate: function(timeDelta)
23     {
24         BouncingParticle.prototype.animate.call(this, timeDelta);
25         this._move();
26     }
27 });
28
29 BouncingCssImagesStage = Utilities.createSubclass(BouncingParticlesStage,
30     function()
31     {
32         BouncingParticlesStage.call(this);
33     }, {
34
35     initialize: function(benchmark, options)
36     {
37         BouncingParticlesStage.prototype.initialize.call(this, benchmark, options);
38         this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
39     },
40
41     createParticle: function()
42     {
43         return new BouncingCssImage(this);
44     },
45
46     particleWillBeRemoved: function(particle)
47     {
48         particle.element.remove();
49     }
50 });
51
52 BouncingCssImagesBenchmark = Utilities.createSubclass(Benchmark,
53     function(options)
54     {
55         Benchmark.call(this, new BouncingCssImagesStage(), options);
56     }
57 );
58
59 window.benchmarkClass = BouncingCssImagesBenchmark;
60
61 })();