Tuesday, January 15, 2013

canvas patterns

0 comments


Canvas Pattern 

What is pattern?

By using pattern () method you can able to create your own pattern.

Simply it is a shape and you may use repeatly. Suppose you create a circle with some effect and now you want to use this circle to fill up a rectangular then you have to use the create circle as a pattern.

Structure:

We can create a pattern by calling create pattern method.It holds two arguments.First the source of pattern then repeat option like 
repeat,no-repeat,repeat-x,repeat-y.

createPattern(Obj, repeatOption);

Sorry your browser does not support canvas tag.Upgrade to latest version pls Sorry your browser does not support canvas tag.Upgrade to latest version pls

Here we create our own shape(single bottom right) and then use this shape as an object of create pattern method.
You can use image as an object.In this case you have to save the image location in a variable and then use this pattern in fillStyle or strokeStyle
like fillStyle=pattern variables name.

Comments

0 comments to "canvas patterns"

Post a Comment

 

Copyright 2010 All Rights Reserved E-tech institute of IT.