1 function BouncingCssShape(stage)
3 BouncingParticle.call(this, stage);
5 this.element = this._createSpan(stage);
10 this.element.style.backgroundColor = stage.randomColor();
14 this.element.style.background = "linear-gradient(" + stage.randomColor() + ", " + stage.randomColor() + ")";
21 BouncingCssShape.prototype = Object.create(BouncingParticle.prototype);
22 BouncingCssShape.prototype.constructor = BouncingCssShape;
24 BouncingCssShape.prototype._createSpan = function(stage)
26 var span = document.createElement("span");
27 span.className = stage.shape + " " + stage.clip;
28 span.style.width = this._size.x + "px";
29 span.style.height = this._size.y + "px";
30 stage.element.appendChild(span);
34 BouncingCssShape.prototype._move = function()
36 this.element.style.transform = "translate(" + this._position.x + "px," + this._position.y + "px)" + this._rotater.rotateZ();
39 BouncingCssShape.prototype.animate = function(timeDelta)
41 BouncingParticle.prototype.animate.call(this, timeDelta);
42 this._rotater.next(timeDelta);
46 function BouncingCssShapesStage(element, options)
48 BouncingParticlesStage.call(this, element, options);
49 this.parseShapeParamters(options);
52 BouncingCssShapesStage.prototype = Object.create(BouncingParticlesStage.prototype);
53 BouncingCssShapesStage.prototype.constructor = BouncingCssShapesStage;
55 BouncingCssShapesStage.prototype.createParticle = function()
57 return new BouncingCssShape(this);
60 BouncingCssShapesStage.prototype.particleWillBeRemoved = function(particle)
62 particle.element.remove();
65 function BouncingCssShapesBenchmark(suite, test, options, recordTable, progressBar)
67 BouncingParticlesBenchmark.call(this, suite, test, options, recordTable, progressBar);
70 BouncingCssShapesBenchmark.prototype = Object.create(BouncingParticlesBenchmark.prototype);
71 BouncingCssShapesBenchmark.prototype.constructor = BouncingCssShapesBenchmark;
73 BouncingCssShapesBenchmark.prototype.createStage = function(element)
75 return new BouncingCssShapesStage(element, this._options);
78 window.benchmarkClient.create = function(suite, test, options, recordTable, progressBar)
80 return new BouncingCssShapesBenchmark(suite, test, options, recordTable, progressBar);