Alien 1 terug naar de inleiding
bekijk de ontwerpschets van de alien in mijn schetsboek
Om gebruik te maken van het ruitjespapier (de code staat onder deze schets) moeten regel 1 t/m 6 vervangen worden door de code van het ruitjespapier
size(960, 540);
float x = width/2;
float y = height/2;
float ny = height/30;
float nx = height/30;
background(#E6FBFF);
//--------------------hoofd-----------------------
fill(255, 0, 0);
beginShape();
{
vertex(x-nx/2, y); //1
vertex(x-nx/2, y-ny); //2
vertex(x-2.5*nx, y-3*ny); //3
vertex(x-2.5*nx, y-4*ny); //4
vertex(x-nx/2, y-2*ny); //5
vertex(x, y-2.5*ny); //6
vertex(x+nx/2, y-2*ny); //7
vertex(x+2.5*nx, y-4*ny); //8
vertex(x+2.5*nx, y-3*ny); //9
vertex(x+nx/2, y-ny); //10
vertex(x+nx/2, y); //11
endShape(CLOSE);
}
fill(0, 0, 255);
//ogen
ellipse(x-nx/2, y-3*ny, nx/2, ny);
ellipse(x+nx/2, y-3*ny, nx/2, ny);
//mond
fill(255, 255, 0);
rectMode(CENTER);
rect(x, y-5*ny/3, 1.5*nx, ny/4);
fill(255, 0, 0);
//schedel
arc(x, y-3*ny, 3*nx, 6*nx, radians(180), radians(360));
//--------------------Lichaam---------------------------
fill(200, 200, 0);
beginShape();
{
vertex(x-1.5*nx, y+7*ny); //1
vertex(x-2.5*nx, y+2.5*ny); //2
vertex(x-nx, y+ny); //3
vertex(x-4.5*nx, y); //4
vertex(x+4.5*nx, y); //5
vertex(x+nx, y+ny); //6
vertex(x+2.5*nx, y+2.5*ny); //7
vertex(x+1.5*nx, y+7*ny); //8
vertex(x, y+3*ny); //9
endShape(CLOSE);
}
fill(255, 0, 0);
rectMode(CENTER);
rect(x, y+ny, 2*nx, ny/4);
Code voor het ruitjespapier
De code komt boven de alien schets ipv regel 1 t/m 6
//fullScreen();
size(960,540);
float x = width/2;
float y = height/2;
float ny = height/20;
float nx = height/20;
background(#E6FBFF);
// horizontale lijntjes
for (float i = 0; i < height/2; i = i + nx) {
line(0, height/2+i, width, height/2+i); //naar beneden
line(0, height/2-i, width, height/2-i); //naar boven
}
//verticale lijntjes
for (float i = 0; i < width/2; i = i + ny) {
line(width/2+i, 0, width/2+i, height); //naar rechts
line(width/2-i, 0, width/2-i, height); //naar links
}
strokeWeight(2);
stroke(255, 0, 0);
//assenstelsel
line(0, height/2, width, height/2);
line(width/2, 0, width/2, height);
//controle punten
strokeWeight(8);
//om de 5 vakjes een controle puntje plaatsen
for (int k = 0; k < height; k = k+5) {
point(x-k*nx, y);
point(x+k*nx, y);
point(x, y-k*ny);
point(x, y+k*ny);
}
strokeWeight(1);
stroke(0);