Graphic JavaScript


Back to index
Square spiral patterns are sometimes called SQUARRALS:

It's possible to generate the values for the corners using JavaScript:
Your browser does not support the HTML5 canvas tag.
This JavaScript example uses a technique known as recursion. Basically, a function is recursive if it calls itself. Obviously, there has to be an endstate defined or else this process could continue forever (or until some outside force puts an end to it). In this case the endstate is when both a+20 and b+20 equal 110 (the endstate value for can.width/2+10 and can.height/2+10).
ASSIGNMENT:

Replicate the following pattern as a JavaScript applet:

You are not required to use any functions to complete this assignment, but you may if you so desire.