Permalink
Browse files

Round stars, ever so slightly off white

  • Loading branch information...
nrkn committed Jan 11, 2012
1 parent 8523608 commit e64b8ff5c5ec21a60f407165e229784f05e5ec6f
Showing with 26 additions and 7 deletions.
  1. +26 −7 canvas.html
View
@@ -1,5 +1,3 @@
-
-
<!doctype html>
<html>
<head>
@@ -14,7 +12,6 @@
body {
background: #eee;
- padding: 1em;
}
#c {
@@ -40,12 +37,34 @@
canvas.height = window.outerHeight
canvas.width = window.outerWidth
+//make stars slightly off-white
+function colorByte(){
+ var variance = 32;
+ return Math.floor( ( Math.random() * variance ) + ( 256 - variance ) );
+}
+
function createStar () {
- var g = new Graphics()
- g.setStrokeStyle(1)
- g.beginFill(Graphics.getRGB(255,255,255,1));
+ var g = new Graphics(),
+ red = colorByte(),
+ green = colorByte(),
+ blue = colorByte(),
+ radius = Math.floor( Math.random() * 8 ) + 2,
+ center = radius / 2;
+
+
+ g.setStrokeStyle(1);
+
+ //star
+ g.beginFill(Graphics.getRGB(red,green,blue,1));
+ g.drawCircle( center, center, radius );
+ g.endFill();
- g.drawRect(0,0, 10, 10);
+ /*
+ //corona
+ g.beginStroke(Graphics.getRGB(red,green,blue,.25));
+ g.drawCircle( center, center, radius + 1 );
+ g.endStroke();
+ */
return new Shape(g);
}

0 comments on commit e64b8ff

Please sign in to comment.