Skip to content

Instantly share code, notes, and snippets.

@optikalefx
Created September 11, 2012 18:03
Show Gist options
  • Save optikalefx/3700349 to your computer and use it in GitHub Desktop.
Save optikalefx/3700349 to your computer and use it in GitHub Desktop.
if(this.particles.length) {
var i,
particles = this.particles,
length = particles.length;
//ctx.globalAlpha = 1;
for(i = 0; i < length; i++){
//ctx.globalAlpha = this.particles[i].opacity;
//ctx.strokeStyle = "rgba(255,255,255,"+this.particles[i].opacity+")";
ctx.save();
ctx.clearRect(this.particles[i].prevX, this.particles[i].prevY, this.particles[i].size + 0, this.particles[i].size + 0);
ctx.moveTo(this.particles[i].x, this.particles[i].y);
ctx.lineTo(this.particles[i].x + this.particles[i].size, this.particles[i].y + this.particles[i].size);
ctx.moveTo(this.particles[i].x, this.particles[i].y + this.particles[i].size);
ctx.lineTo(this.particles[i].x + this.particles[i].size, this.particles[i].y);
ctx.lineWidth = 1;
ctx.strokeStyle = "rgba(255,255,255,"+this.particles[i].opacity / 2+")";
//ctx.translate(this.particles[i].x, this.particles[i].y);
//ctx.rotate(30*Math.PI/180);
ctx.stroke();
ctx.strokeStyle = "rgba(255,255,255,"+this.particles[i].opacity+")";
ctx.strokeRect(this.particles[i].x, this.particles[i].y, this.particles[i].size, this.particles[i].size);
ctx.restore();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment