/* line 1 */ canvas = document.getElementById("canvas"); /* line 2 */ canvas.addEventListener("click", MyHandler);
A click event is generated and added to the event queue. When the event reaches the top of the queue, the event dispatcher removes the event. The event dispatcher calls the function MyHandler with the event as an argument. Function MyHandler is executed.
f(t, α, β) = α(1-t) + βt
0 ≤ t ≤ 1
y = r sin(θ);
for(t = 0; t &= 1; t += dx) { theta = LERP(0,7200, t); r = LERP(0, canvas.width/2; t); hue = LERP(240, 360, t); x = r*Math.cos(theta); y = r*Math.sin(theta); color = "hsl(" + hue + ", 100%, 50%)"; SetPixel(x,y, color); }Please see spiral.html
Computations should be as efficient as possible, by reducing the number of operations and the data types involved.
The algorithm uses the x axis as the axis of major change between 90° and 45° after that, the y axis becomes the axis of major change.
img = document.createElement("img"); img.addEventListener("load",SetTimer);
setInterval(DoMove, 100);