RADIAL DESIGNS
|
BASIC SPIRAL
|
BASIC SPIRAL
var radius = 0;
var angle = 0;
ctx.beginPath();
ctx.moveTo(can.width/2, can.height/2);
for(var n=0; n<240; n++){
radius += 0.75;
angle += (Math.PI*2)/50;
var x = can.width/2 + radius * Math.cos(angle);
var y = can.height/2 + radius * Math.sin(angle);
ctx.lineTo(x,y);
}
ctx.stroke();
|
|
SPRIAL OF STARS
|
SPIRAL OF STARS
ctx.moveTo(can.width/2, can.height/2);
for(var n=0; n<120; n++){
radius += 1.2;
angle += (Math.PI*2)/30;
var x = can.width/2 + radius * Math.cos(angle);
var y = can.height/2 + radius * Math.sin(angle);
drawStar(x,y,3);
}
|
|
RADIAL ROWS OF STARS
|
RADIAL ROWS OF STARS
for(var n = 0; n<12; n++){
angle += (Math.PI*2)/12;
radius = 10;
ctx.strokeStyle=colors[current_color];
for(var m=0; m<5; m++){
radius += 30;
var x = can.width/2 + radius * Math.cos(angle);
var y = can.height/2 + radius * Math.sin(angle);
drawStar(x,y,3);
}
current_color+=1;
}
|
|
FLOWER PETALS
|
FLOWER PETALS
function drawPetal(h,k,a){
ctx.beginPath();
ctx.lineWidth=3;
var h1=h;
var k1=k;
var rt=a+Math.PI/6.0;
for(var theta = 0; theta < 21; theta++){
var x1 = h1 + 7*Math.cos(rt);
var y1 = k1 + 7*Math.sin(rt);
h1=x1; k1=y1;
rt= rt - Math.PI/60.0;
ctx.lineTo(x1,y1);
}
ctx.stroke();
ctx.beginPath();
var rt=a-Math.PI/6.0;
for(var theta = 0; theta < 21; theta++){
var x1 = h + 7*Math.cos(rt);
var y1 = k + 7*Math.sin(rt);
h=x1; k=y1;
rt= rt + Math.PI/60.0;
ctx.lineTo(x1,y1);
}
ctx.stroke();
}
|
|
EXPLOSION
|
EXPLOSION
function goBang() {
ctx.clearRect(0,0,w,h);
ctx.fillStyle="black";
ctx.fillRect(0,0,w,h);
ctx.lineWidth=5;
ctx.strokeStyle = "yellow";
ctx.beginPath();
ctx.moveTo(xcor(0),ycor(0));
for(var i=1; i<20; i++){
x=xcor(i);
y=ycor(i);
ctx.lineTo(x,y);
}
radi+=10;
if(radi>180){
radi=10;
}
ctx.closePath();
ctx.stroke();
}
|
|