xxxxxxxxxx
30
function setup() {
createCanvas(400, 400);
}
function draw(){
background(222);
worm(100, 100, radians(0));
worm(300, 100, radians(-45));
worm(200, 300, radians(10));
//------------the important function
function worm(x, y, rotation){
strokeWeight(3);
rectMode(CENTER);
push();
translate(x, y);
rotate(rotation);
stroke(3);
rect(0, 0, 150, 50);
line(50, 0, 75, 0);
strokeWeight(5);
point(60, -15);
pop();
}
}