Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!Doctype>
- <html>
- <head>
- <title>Canvas Smiley box</title>
- </head>
- <body>
- <canvas id="smile" width="500px" height="600px" Style="border:1px solid black;">
- Get Chrome Dude!
- </canvas>
- <script>
- var canvas=document.getElementById('smile');
- var s=canvas.getContext('2d');
- s.strokeStyle='black';
- s.fillStyle='white';
- s.lineWidth=3;
- s.beginPath();//left eye
- s.arc(100,100,50,0,Math.PI,true);
- s.stroke();
- s.beginPath();//left eye lower curve
- s.moveTo(50,100);
- s.bezierCurveTo(75,70,120,70,150,100);
- s.stroke();
- s.beginPath();//right eye
- s.arc(400,100,50,0,Math.PI,true);
- s.stroke();
- s.beginPath();//right eye lower curve
- s.moveTo(350,100);
- s.bezierCurveTo(375,70,420,70,450,100);
- s.stroke();
- s.beginPath();//outer nose line
- s.moveTo(175,350);
- s.bezierCurveTo(170,70,355,70,350,350);
- s.stroke();
- s.beginPath();//inner nose line
- s.moveTo(195,350);
- s.bezierCurveTo(190,70,335,120,330,350);
- s.stroke();
- s.beginPath();//left closure of nose
- s.moveTo(350,350);
- s.lineTo(330,350);
- s.stroke();
- s.beginPath();//right side closing of nose
- s.moveTo(175,350);
- s.lineTo(195,350);
- s.stroke();
- s.beginPath();//upper lip
- s.moveTo(100,350);
- s.bezierCurveTo(150,450,350,450,400,350);
- s.stroke();
- s.beginPath();//lower lip
- s.moveTo(100,350);
- s.bezierCurveTo(50,550,440,550,400,350);
- s.stroke();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement