Permalink
Browse files

use hex bg color, better motion blur, hardware acceleration

  • Loading branch information...
1 parent e0919e3 commit 1aaa50d939f35282e72d447d3ffad90591f94514 @matthewlein committed Mar 25, 2012
Showing with 8 additions and 14 deletions.
  1. +5 −0 index.html
  2. +3 −14 orbular.js
View
5 index.html
@@ -10,6 +10,11 @@
border: 1px solid #999;
display: block;
margin: auto;
+ -webkit-transform: translateZ(0);
+ -moz-transform: translateZ(0);
+ -ms-transform: translateZ(0);
+ -o-transform: translateZ(0);
+ transform: translateZ(0);
}
body {
background-color: #222;
View
17 orbular.js
@@ -132,7 +132,6 @@ var Orbular = (function(){
this.motionBlur = this.opts.motionBlur;
this.bgColor = this.opts.bgColor;
-
this.orbs = [];
};
@@ -182,12 +181,8 @@ var Orbular = (function(){
clearCanvas : function() {
ctx.save();
//semi-transparent box for motion trails
- var r = Math.round( this.bgColor[0] );
- var g = Math.round( this.bgColor[1] );
- var b = Math.round( this.bgColor[2] );
- var a = (1 - this.motionBlur);
-
- ctx.fillStyle = "rgba(" + r + "," + g + "," + b + "," + a + ")";
+ ctx.fillStyle = this.bgColor;
+ ctx.globalAlpha = (1 - this.motionBlur);
ctx.fillRect(0,0,cWidth,cHeight);
ctx.restore();
@@ -237,7 +232,7 @@ var Orbular = (function(){
motionBlur : 0.02,
angle : 0,
orbColor : "#ffae23",
- bgColor : [255,255,255]
+ bgColor : "#ffffff"
}
var userOpts = {};
@@ -250,20 +245,15 @@ var Orbular = (function(){
}
var opts = extend( {}, defaultOpts, userOpts);
-
-
var orbHolder = new OrbPile(opts);
-
// --------------------------------------------------------------------- //
// dat.GUI controller
// --------------------------------------------------------------------- //
-
var gui = new dat.GUI();
-
var guiController = {
arms : gui.add(orbHolder, 'arms', 1, 25).step(1),
armLength : gui.add(orbHolder, 'armLength', 1, 550).step(1),
@@ -278,7 +268,6 @@ var Orbular = (function(){
};
// set change event
- // TODO throttle?
for (var i=0; i < gui.__controllers.length; i++) {
gui.__controllers[i].onChange(function(value) {
userOpts[this.property] = value;

0 comments on commit 1aaa50d

Please sign in to comment.