

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


its properties let cx = document.querySelector("canvas").getContext("2d"); // start drawing cx.beginPath(); // start at (20,70) to draw quadratic curve cx.moveTo(20,70); // draw to control point at (60, 10), and ends at (70, 80) cx.quadraticCurveTo(60, 10, 70, 80); // create stroke cx.stroke();
its properties let cx = document.querySelector("canvas").getContext("2d"); // start drawing cx.beginPath(); // start at (20,90) to draw bezier curve cx.moveTo(20, 90); // draw to control1 at (20, 10), control2 at (100, 10), and ends at (60, 90) cx.bezierCurveTo(20, 10, 100, 10, 60, 90); // from (60, 90) draw a line to (100, 10) cx.lineTo(100, 10); // from (100, 10) draw a line to (20,10) cx.lineTo(20, 10); // close the opening from (20, 10) to (20, 90) cx.closePath(); // fill in the shape cx.fill();
its properties let cx = document.querySelector("canvas").getContext("2d"); // start drawing cx.beginPath(); // left eye // draw the circle w/ the center=(130, 40) radius=10 angle=0 to 7 cx.arc(130, 40, 10, 0, 7); // fill in the shape
cx.fill(); // right eye // draw the circle w/ the center=(170, 40) radius=10 angle=0 to 7 cx.arc(170, 40, 10, 0, 7); // fill in the shape cx.fill(); // smile // start a drawing, so that we don't connect the eyes to the mouth cx.beginPath(); // draw the curve w/ the center=(150,50) radius=40 angle=0 to ½π cx.arc(150, 50, 40, 0, 1 * Math.PI); // create stroke cx.stroke();