HTML5 Canvas Beginpath () method

Source: Internet
Author: User

The Beginpath () method starts a path or resets the current path. W3school on the explanation!

Path is a very important concept in canvas, people who have just started to learn the canvas are not very deep understanding of the path, they will use the canvas when the Beginpath (), a small demo today to illustrate the path

If you do not change this code, the display of a red line and blue lines, we will think, what is there to say, it must be so ah.

Next we annotate the second context.stroke (), and you'll see that the final result is just a blue line, because the first path has no stroke (), followed by a

On the re-opening of a path, so that only the second path to draw a straight line, we are not found more and more magical?

And then I put the Context.beginpath () out of the comment context.stroke (), what did you find? It's amazing that you found a Purple Line and a blue line, why? It turned out that there was no new path, so the second stroke () re-drew the first line and used blue, while the first stroke () had already drawn the first line in red, and the combination of blue and red became purple, and the second

Context.stroke (); painted blue.

What do you think about the Beginpath () and the stroke ()? Two blue lines, you were good

HTML5 Canvas Beginpath () method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.