Html5 Book

HTML5, the latest version of HTML, the formatting language that produces web pages - including the one you read this on, of course - has taken the web development community by storm.

On one hand, it is easy to learn; On the other hand, it has the potential to evolve and then pose a serious threat to Flash, which is more or less synonymous with impressive animations.

HTML5 has come about thanks to the cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG), in their collective pursuit to make the web a true treasure trove for mankind.

Finding a good book to master HTML5 can be very challenging: there are so many around - most with eye-catching titles and very complex substance.
Therefore, Vivax Solutions strongly recommends Core HTML5 Canvas for those who really want to delve into HTML5.
Please click the image to access Amazon:



Creating 2-D Animations on Canvas

The Rhodonea Curve

A beautiful animation based on Rhodonea Curve:







<script>
var canvas = document.getElementById('Canvas_One');
var context = canvas.getContext('2d');
var i = 0; j = 0.1, t = 0;
var col = new Array('green', 'blue', 'red', 'cyan', 'magenta', 'yellow');
function timing() {
t = t + 1;
i = i + j;
var r = 150 * Math.cos(2 * i);
if (t > 5) { t = 0; }
//var r=Math.pow(10000*Math.cos(2*i),0.5);
var x = 200 + r * Math.sin(i); var y = 200 + r * Math.cos(i);
//context.font="40px Georgia";
//context.textAlign='center';
//context.fillText('.',x,y);
//context.fillStyle='purple';
context.beginPath();
context.moveTo(200, 110);
context.lineTo(x, y);
context.lineCap = 'round';
context.strokeStyle = 'rgba(0,0,255,0.5)';
context.stroke();
context.beginPath();
context.moveTo(200, 110);
context.arc(x, y, 5, 0, 2 * Math.PI);
context.fillStyle = col[t];
context.fill();
if (i > 6.4) { j = -0.1; context.clearRect(0, 0, 400, 400); }
if (i < -0.1) { j = 0.1; context.clearRect(0, 0, 400, 400); }
}
window.setInterval('timing()', 400);
</script>




<-Go to twenty second Lesson Go to twenty fourth->