1 function BouncingCompositedImage(stage)
3 BouncingParticle.call(this, stage);
5 this.element = document.createElement("img");
6 this.element.style.width = this._size.x + "px";
7 this.element.style.height = this._size.y + "px";
8 this.element.setAttribute("src", stage.imageSrc);
11 this.element.style.filter = "hue-rotate(" + stage.randomAngle() + "rad)";
13 stage.element.appendChild(this.element);
17 BouncingCompositedImage.prototype = Object.create(BouncingParticle.prototype);
18 BouncingCompositedImage.prototype.constructor = BouncingCompositedImage;
20 BouncingCompositedImage.prototype._move = function()
22 this.element.style.transform = "translate3d(" + this._position.x + "px," + this._position.y + "px, 0) " + this._rotater.rotateZ();
25 BouncingCompositedImage.prototype.animate = function(timeDelta)
27 BouncingParticle.prototype.animate.call(this, timeDelta);
31 function CompositingTransformsStage(element, options)
33 BouncingParticlesStage.call(this, element, options);
34 this.imageSrc = options["imageSrc"] || "../resources/yin-yang.svg";
35 this.useFilters = options["filters"] == "yes";
38 CompositingTransformsStage.prototype = Object.create(BouncingParticlesStage.prototype);
39 CompositingTransformsStage.prototype.constructor = CompositingTransformsStage;
41 CompositingTransformsStage.prototype.createParticle = function()
43 return new BouncingCompositedImage(this);
46 CompositingTransformsStage.prototype.particleWillBeRemoved = function(particle)
48 particle.element.remove();
51 function CompositedTransformsBenchmark(suite, test, options, recordTable, progressBar)
53 BouncingParticlesBenchmark.call(this, suite, test, options, recordTable, progressBar);
56 CompositedTransformsBenchmark.prototype = Object.create(BouncingParticlesBenchmark.prototype);
57 CompositedTransformsBenchmark.prototype.constructor = CompositedTransformsBenchmark;
59 CompositedTransformsBenchmark.prototype.createStage = function(element)
61 return new CompositingTransformsStage(element, this._options);
64 window.benchmarkClient.create = function(suite, test, options, recordTable, progressBar)
66 return new CompositedTransformsBenchmark(suite, test, options, recordTable, progressBar);