Firstly notice the style declaration in the tag. This enlarges the image from 256 x 256 to 512 x 512.
Because the timer is continually running you have to get notified when the src is changed. In a real world application the images onload event will replace the button and onclick event.
The timer is simple to implement and the 50 stands for 50 milliseconds. 1000 / 50 = 20 ticks per second.
Running the file on firefox gives us this output. On chrome it won't work, the image must be in a domain. Pressing the button at anytime produces this output.
No comments:
Post a Comment