Skip to content

Instantly share code, notes, and snippets.

@xaicron
Created June 4, 2012 16:53
Show Gist options
  • Save xaicron/2869515 to your computer and use it in GitHub Desktop.
Save xaicron/2869515 to your computer and use it in GitHub Desktop.
--- bgcanvas.js 2012-06-03 21:30:12.000000000 +0900
+++ bgcanvas2.js 2012-06-05 01:46:19.000000000 +0900
@@ -154,7 +154,7 @@
gradblur.addColorStop(0.9, edgecolor3);
gradblur.addColorStop(1.0, edgecolor4);
ctx.fillStyle = gradblur;
- ctx.arc(this.x, this.y, this.r, 0, Math.PI * 2, true);
+ ctx.arc(this.x, this.y, this.r, 0, 6.283185307179586, true);
ctx.closePath();
ctx.fill();
};
@@ -208,7 +208,43 @@
var $this = this;
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.circles.forEach((function (circle) {
- circle.draw$LCanvasRenderingContext2D$($this.ctx);
+ /** @type {CanvasRenderingContext2D} */
+ var ctx$0;
+ /** @type {!string} */
+ var R$0;
+ /** @type {!string} */
+ var G$0;
+ /** @type {!string} */
+ var B$0;
+ /** @type {!string} */
+ var edgecolor1$0;
+ /** @type {!string} */
+ var edgecolor2$0;
+ /** @type {!string} */
+ var edgecolor3$0;
+ /** @type {!string} */
+ var edgecolor4$0;
+ /** @type {CanvasGradient} */
+ var gradblur$0;
+ ctx$0 = $this.ctx;
+ ctx$0.beginPath();
+ R$0 = circle.R + "";
+ G$0 = circle.G + "";
+ B$0 = circle.B + "";
+ edgecolor1$0 = 'rgba(' + R$0 + ',' + G$0 + ',' + B$0 + ',0.93)';
+ edgecolor2$0 = 'rgba(' + R$0 + ',' + G$0 + ',' + B$0 + ',0.6)';
+ edgecolor3$0 = 'rgba(' + R$0 + ',' + G$0 + ',' + B$0 + ',0.1)';
+ edgecolor4$0 = 'rgba(' + R$0 + ',' + G$0 + ',' + B$0 + ',0)';
+ gradblur$0 = ctx$0.createRadialGradient(circle.x, circle.y, 0, circle.x, circle.y, circle.r);
+ gradblur$0.addColorStop(0.0, edgecolor1$0);
+ gradblur$0.addColorStop(0.4, edgecolor1$0);
+ gradblur$0.addColorStop(0.7, edgecolor2$0);
+ gradblur$0.addColorStop(0.9, edgecolor3$0);
+ gradblur$0.addColorStop(1.0, edgecolor4$0);
+ ctx$0.fillStyle = gradblur$0;
+ ctx$0.arc(circle.x, circle.y, circle.r, 0, 6.283185307179586, true);
+ ctx$0.closePath();
+ ctx$0.fill();
if (circle.x + circle.dx > $this.canvas.width || circle.x + circle.dx < 0) {
circle.dx = - circle.dx;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment