javascript - How can we take advantage of moveTo( ) HTML5 method? -


Please feel confused to me, so I need your help

My question is that we How can the moveTo () get the benefit of the html5 method?

For example, I found this example on the stack overlay

  function drawSmile (CTX, X, Y, FaceRD, IRDDs) {CTX. // save ctx.fillStyle = '# FF6'; // Face Style: Fill Color Yellow CTX. Translestate (X, Y); // Now (x, y) canvas (0,0) is ctx.beginPath (); // path ctx.arc for face (0, 0, face radix, 0, 6.28); Ctx.fill (); Ctx.fillStyle = '# 000'; // Eye Style: Fill color is black ctx.beginPath (); // Path for two eyes ctx.arc (face radix / 2, - face radix / 3, eye radius, 0, 6.28); Ctx.moveTo (- fourth triangle / 2, - face radix / 3); // Second eye CTX Sub path for CR (-FlashRDs / 2, - FaceRDIS / 3, IRDDS, 0, 6.28); Ctx.fill (); Ctx.restore (); // Reference just before entering the drawSmile is fine} Dormile (C, 200,200, 60, 12);  

But when I removed the line number 11 in the code which uses the hilft method, nothing is changing !!!!

moveTo () , 0) at the second point in the original location.

Here you have more examples. To attract any type of triangle:

Enter image details here

  // First part of the route ctx.moveTo (20,20); Ctx.lineTo (100, 100); Ctx.lineTo (100.0); // The second part of the path ctx.moveTo (120,20); Ctx.lineTo (200, 100); Ctx.lineTo (200,0); // indicate the stroke color + path ctx.strokeStyle = "# 0000FF"; Ctx.stroke ();  

In this example, we just call moveto (x, y) after drawing the first part of the code (the size to the left side of the code). Then, we only called stroke () to attract the whole path once.


Comments