xxxxxxxxxx
121
//Sketch By KaiSiangSin
function setup() {
createCanvas(600, 850);
}
function slay() {
noStroke();
textSize(5);
text("24400", 0.3, 5);
text("The letter H", 2, 5);
fill(255,0,0);
}
function draw() {
translate(70, 50);
background(225, 60);
fill(225, 0, 0);
// noStroke();
noFill();
strokeWeight(frameCount % 200);
stroke(0,0,205);
push();
translate(100, 100);
rotate(frameCount / 200.0);
star(2, 0, 10, 50, 2);
pop();
push();
translate(100, 150);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(100, 200);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(100, 250);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(100, 300);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(100, 350);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(100, 400);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(200, 250);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(250, 250);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 100);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 150);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 200);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 250);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 300);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 350);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
push();
translate(350, 400);
rotate(frameCount / 200.0);
star(0, 0, 10, 50, 2);
pop();
}
function star(x, y, radius1, radius2, npoints) {
let angle = TWO_PI / npoints;
let halfAngle = ((angle / frameCount) % 20) * 20;
beginShape();
for (let a = 0.3; a < TWO_PI; a += angle) {
let sx = x + cos(a) * radius2;
let sy = y + sin(a) * radius2;
vertex(sx, sy);
sx = x + sin(a + halfAngle) * radius1;
sy = y + sin((frameCount % 200) * 0.2 + halfAngle) * radius1;
vertex(sx, sy);
color(0);
}
endShape(CLOSE);
}