Code

Code

I just learned how to code javascript on khan academy this is the dog that I made.

var x = 200;
var y = 220;

background(221, 0, 255);

//face
fill(117, 94, 4);
stroke(77, 55, 3);
arc(x+30, y-40, 237, 200, 10, 180);//nose
fill(117, 94, 4);
ellipse(x-55, y-20, 239, 218);//hed
ellipse(x-90, y+10, 114, 215);//ear
fill(0, 0, 0);
arc(x, y-90, 33, 41, 1, 180);//eye
ellipse(x+142, y-22, 29, 20);//nose (tip)
fill(117, 94, 4);
noStroke();
rect(x-10, y-35, 75, 90);//blok for nose

//out side border
fill(205, 115, 196);
//bottom left
rect(0, 330, 10, 10);
rect(0, 340, 20, 10);
rect(0, 350, 30, 10);
rect(0, 360, 40, 10);
rect(0, 370, 50, 10);
rect(0, 380, 60, 10);
rect(0, 390, 400, 10);
//bottom right
rect(390, 330, 10, 70);
rect(380, 340, 10, 60);
rect(370, 350, 10, 50);
rect(360, 360, 10, 40);
rect(350, 370, 10, 30);
rect(340, 380, 10, 20);
rect(330, 390, 10, 10);
//top left
rect(0, 0, 330, 10);
rect(0, 10, 60, 10);
rect(0, 20, 50, 10);
rect(0, 30, 40, 10);
rect(0, 40, 30, 10);
rect(0, 50, 20, 10);
rect(0, 60, 10, 270);
//top right
rect(330, 0, 70, 10);
rect(340, 10, 60, 10);
rect(350, 20, 50, 10);
rect(360, 30, 40, 10);
rect(370, 40, 30, 10);
rect(380, 50, 20, 10);
rect(390, 60, 10, 270);





An this is the dinner plate that I made

var carrot = function(x,y){
 fill(255, 170, 0);
 ellipse(x, y, 46, 11);
 fill(92, 168, 104);
};
var brocolyStem = function(x,y){
 fill(17, 250, 5);
 rect(x, y, 45, 11);
};
var brocolyHead = function(x,y){
 fill(13, 150, 6);
 stroke(9, 61, 5);
 strokeWeight(0.5);
 ellipse(x, y, 10, 10); 
 noStroke();
};

background(166, 124, 10); // wooden table

//plate
stroke(0, 0, 0);
fill(250, 250, 245);
ellipse(200, 200, 350, 350);
ellipse(200, 200, 300, 300); 

//spagetty
stroke(242, 245, 161);
strokeWeight(4);
line(284, 297, 80, 192);
line(197, 350, 100, 162);
line(244, 167, 140, 332);
line(258, 332, 126, 161);
line(313, 260, 146, 168);
line(329, 201, 83, 261);
line(282, 176, 103, 289);
line(212, 353, 192, 162);
line(295, 285, 66, 223);
line(346, 237, 115, 321);
line(162, 162, 104, 321);
line(338, 212, 118, 309);

//carrot
fill(252, 147, 36);
noStroke();
strokeWeight(4);
carrot(189, 90);
carrot(126, 115);
carrot(156, 138);
carrot(186, 111);
carrot(162, 65);
carrot(125, 88);
carrot(88, 144);

//brocoly #1
brocolyStem(188, 132);
brocolyHead(232, 132);
brocolyHead(235, 139);
brocolyHead(238, 131);
brocolyHead(234, 124); 
brocolyHead(243, 139);
brocolyHead(242, 123);
brocolyHead(239, 144);
brocolyHead(245, 130);
brocolyHead(232, 142);
brocolyHead(249, 144);
brocolyHead(251, 136);
brocolyHead(249, 124);
brocolyHead(255, 130);

Leave a Reply

Your email address will not be published. Required fields are marked *