Monday, January 30, 2012, 04:25 AM ( 1730 views )  - Posted by Administrator
This is a small example of a canvas animation
Canvas in HTML 5 is a powerfull tool. A lot of coders think it will replace Adobe Flash ... We don't know but it is certainly the wish of Apple.Here you will find a very simple example of its use. You can download all the code here
first add a canvas in your html.
id="myctx" width="512" height="512"
             style=" background-color: black;border:1px solid #c3c3c3;">

        var myctx = document.getElementById("myctx");

        var ctx = myctx.getContext('2d');

Canvas object has the property "getContext ('2 d ');" which you can draw.
The event setInterval is the easiest way to make annimations.

<<First <Back | 1 | 2 |