Canvas - noi duong 1
RUN
<!DOCTYPE HTML> <html> <head> <title>Canvas Nối Nhiều Đường</title> <meta charset="UTF-8"> </head> <body> <canvas id="myCanvas" width="578" height="200" style="border: solid 1px"></canvas> <script> var canvas = document.getElementById('myCanvas'); var context = canvas.getContext('2d'); context.beginPath(); context.moveTo(100, 20); // line 1 context.lineTo(200, 160); // quadratic curve context.quadraticCurveTo(230, 200, 250, 120); // bezier curve context.bezierCurveTo(290, -40, 300, 200, 400, 150); // line 2 context.lineTo(500, 90); context.lineWidth = 5; context.strokeStyle = 'blue'; context.stroke(); </script> </body> </html>
PHÓNG TO