DEV Community

Cover image for Javascript - Challenge: Brown bear eyes from khanAcademy -00009
Adem Deliaslan
Adem Deliaslan

Posted on • Updated on

Javascript - Challenge: Brown bear eyes from khanAcademy -00009

Dependency of the shapes sizes and positions
(with process.JS)
__x, y ve faceSize değişse dahi oran/orantı ve pozisyonları sabit kalacaktır.

noStroke();
var x = 197;
var y = 275;
var faceSize = 400;

// ears
var earSize=faceSize*1/2;
fill(89, 52, 17);
ellipse(x-faceSize*2/5, y-faceSize*2/5, earSize, earSize);
ellipse(x+faceSize*2/5, y-faceSize*2/5, earSize, earSize);

// face
fill(163, 113, 5);
ellipse(x, y, faceSize, faceSize);

//eyes
fill(0, 0, 0);
ellipse(x-faceSize/4, y-faceSize/8, faceSize*1/8, faceSize*1/8);
ellipse(x+faceSize/4, y-faceSize/8, faceSize*1/8, faceSize*1/8);

//nose
fill(89, 52, 20);
ellipse(x, y+faceSize/8, faceSize*4/15, faceSize/5);

Top comments (1)

Collapse
 
saikiran profile image
Sai Kiran

Thats Cool, Reminded me of challenge i did when i was starting out

dev.to/krngd2/my-very-first-javasc...