Documente Academic
Documente Profesional
Documente Cultură
GRAFICA PE CALCULATOR
Lucrare de laborator 1
Varianta 3
2022
A realizat: Darwin
A controlat :
Chişinău 2022
Lucrarea de laborator 1
Sarcina lucrării:
function setup() {
createCanvas(800, 600);
}
function draw() {
// Adăugăm fundalul scenei
background(220);
// Adăugăm mâinile
fill(255, 0, 0);
rect(75, 350, 75, 20); // mâna stângă
rect(225, 350, 75, 20); // mâna dreaptă
ellipse(200, 300, 150, 200);
// Adăugăm picioarele
fill(0, 0, 255);
rect(150, 550, 25, 75); // picior stâng
rect(225, 550, 25, 75); // picior drept
// Adăugăm mâinile
fill(255, 0, 0);
rect(525, 300, 20, 75); // mâna stângă
rect(725, 300, 20, 75); // mâna dreaptă
// Adăugăm picioarele
fill(0, 0, 255);
rect(575, 450, 150, 25); // picior stâng
rect(575, 450, 75, 25); // picior drept
// iarbă
fill(5, 200, 5);
stroke(5, 5, 5);
rect(0, 570, width, height);
// soare
fill(255, 255, 0);
noStroke();
ellipse(width * 0.75, height * 0.25, 150);
// raze soare
stroke(255, 255, 0);
strokeWeight(3);
noFill();
beginShape();
vertex(width * 0.75, height * 0.25);
vertex(width * 0.80, height * 0.35);
vertex(width * 0.95, height * 0.30);
endShape();
beginShape();
vertex(width * 0.75, height * 0.25);
vertex(width * 0.70, height * 0.35);
vertex(width * 0.55, height * 0.30);
endShape();
beginShape();
vertex(width * 0.75, height * 0.25);
vertex(width * 0.70, height * 0.15);
vertex(width * 0.55, height * 0.20);
endShape();
beginShape();
vertex(width * 0.75, height * 0.25);
vertex(width * 0.80, height * 0.15);
vertex(width * 0.95, height * 0.20);
endShape();
// nori
noStroke();
fill(255);
beginShape();
vertex(50, 50);
bezierVertex(20, 20, 80, 20, 80, 50);
bezierVertex(70, 30, 50, 80, 50, 50);
endShape();
beginShape();
vertex(250, 100);
bezierVertex(250, 70, 280, 70, 280, 100);
bezierVertex(280, 130, 250, 130, 250, 100);
endShape();
beginShape();
vertex(150, 200);
bezierVertex(150, 170, 180, 170, 180, 200);
bezierVertex(110, 230, 150, 230, 150, 200);
endShape();
}
2. Elaborați un program care crează versiunea vectorială a personajul desenat în
lucrarea de laborator nr.1. Variantele sunt indicate în tabelul 1.2. E permis de realizat în editor
grafic vectorial.
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255);
// Coama
noStroke();
fill('#680808');
beginShape();
vertex(coamaX, coamaY);
arc(coamaX, coamaY, 355, 400, -PI/4, PI/4, PIE);
vertex(coamaX, coamaY);
arc(coamaX, coamaY, 355, 400, PI/4, 3*PI/4, PIE);
vertex(coamaX, coamaY);
arc(coamaX, coamaY, 355, 400, 3*PI/4, 5*PI/4, PIE);
vertex(coamaX, coamaY);
arc(coamaX, coamaY, 355, 400, -3*PI/4, -PI/4, PIE);
endShape(CLOSE);
// Urechile
noStroke();
fill('#FCD116');
ellipse(170, 160, 50, 50);
ellipse(230, 160, 50, 50);
fill('#AD0F0F');
ellipse(170, 160, 40, 40);
ellipse(230, 160, 40, 40);
// Ochii
fill('#000000');
ellipse(185, 190, 15, 15);
ellipse(210, 190, 15, 15);
// boticul
fill('#000000');
ellipse(200, 231, 35, 15);
// gura
noFill();
stroke('#000000');
strokeWeight(3);
arc(200, 245, 50, 30, 0.2, PI - 0.2);
// mustati
strokeWeight(2);
line(200, 250, 120, 200);
line(200, 250, 150, 200);
line(200, 250, 300, 195);
bezier(220, 230, 240, 215, 240, 215, 220, 230);
bezier(150, 220, 160, 215, 160, 215, 160, 230);
bezier(260, 225, 240, 215, 240, 215, 260, 230);