Skip to content

Commit

Permalink
Support transparent backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
sirxemic committed Sep 3, 2015
1 parent b3961cd commit b9f200e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/jquery.ripples.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@

this.visible = true;

gl.clearColor(0, 0, 0, 0);
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);

// Init animation
function step() {
that.step();
Expand Down Expand Up @@ -240,6 +243,8 @@

render: function() {
gl.viewport(0, 0, this.canvas.width, this.canvas.height);

gl.enable(gl.BLEND);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

gl.useProgram(this.renderProgram.id);
Expand All @@ -254,6 +259,7 @@
gl.uniform1i(this.renderProgram.locations.samplerRipples, 1);

this.drawQuad();
gl.disable(gl.BLEND);
},

update: function() {
Expand Down

0 comments on commit b9f200e

Please sign in to comment.