Logo
  Sunday, May 20, 2012
Sign-In  |  Sign-Up  |  Contact Us  | Bookmark |  RSS Feed

HTML5 Tutorial FeedBurner

Using HTML5 Stroke Styles  
HTML5 provides with new styling capabilities when it comes to canvas. We can improve the way lines are drawn on canvas with the help of stroke styles. The HTML5 stroke styles are used to modify properties of the context to make our shapes look more users friendlier.

See example below for simple representation of Stroke Styles

<script>

    function contextExample(context)

    {

        context.lineWidth = 10;

        context.lineJoin = 'round'

        context.strokeStyle = '#881199'

        context.stroke();

    }

</script>

As you can see , all that we did before stroking, we applied properties to change appearance. We did this by increasing size to 10, making it round coroners and applying color to the stroke. This allows us to draw more appealing lines, object on HTML5 canvas. There are additional properties available for us in HTML5 that can help style strokes. They will be covered in other tutorials on HTML5 development.

Print Using HTML5 Stroke Styles Bookmark Using HTML5 Stroke Styles

Related Articles  
HTML5 Canvas Transforms context.rotate(x) function
HTML5 provides several transform operations: scale, translate, rotate and others. Let’s look at the context.rotate(x) ...
HTML5 canvas browser compatibility
HTML5 is not official and mandated version of HTML and not every browser vendor supports it. You need to be aware of ...
Drawing Curves in HTML5
HTML5 allows you to draw curves on HTML5 canvas. They way to do it is with the help of paths.
Working with HTML5 Paths
The HTML5 Paths are designed to represent any shape that you may want to render. You would use beginPath call to start ...
HTML5 Fill Styles
HTML5 canvas allows you to fill paths and subpaths. The Fill Styles are used for this purpose and you can do it with ...
HTML5 Background Patterns
Images can be used throughout web application, but sometimes it is useful to set images as backgrounds.
More