Make an app for creating spiral designs by incrementally rotating squares in a stack.
Run the code to rotate a square by 30 degrees. Try different angles (e.g. 45 degrees):
This draws a default rectangle, which is a horizontal square:
This draws the square rotated:
Create an interface with a slider to rotate the square. Try angle ranges other than 360:
You can make anything interactive in the Wolfram Language with Manipulate—for example, this code:
First replace the numeric angle value with a variable named angle:
Then wrap the expression with Manipulate and specify the range of the variable. Manipulate automatically constructs an interface with a slider that controls the value of the angle:
Make a stack of 10 squares rotated in 5-degree increments. Try other increments or other numbers of squares:
Table makes lists of elements, one for each value of a variable in a specified range. For example, this makes a list of even numbers:
This uses Table to make a stack of rectangles, each one rotated 5 degrees more than the one below it. It doesn’t look like a stack of rectangles because you can’t see their edges:
Make the edges white so you can see the individual rectangles in the stack:
Create an interface for changing the rotation increment between 0 and 45 degrees:
This draws a stack of rectangles:
Make that expression interactive with Manipulate. Replace the numeric angle value with a variable named angle:
Then wrap the expression with Manipulate and specify the range of the angle variable:
Add another control for changing the number of squares:
The number of squares in this expression is determined by the value 10:
Replace 10 by the variable n, and specify that n goes from 1 to 100 in steps of 1:
Make a sequence of progressively smaller squares. Try increments other than 5 degrees:
This draws a stack of squares rotated in 5-degree increments:
This uses Scale to scale down the squares as they rotate. The scale factor is 1-r/10, which goes from 1 to 0 as r goes from 0 to 10. The effect is to scale the squares from full-sized down to nothing:
Put everything together. Find flower-like and other patterns:
Add scaling so that the rectangles get smaller as they rotate. Now you have a complete interface for exploring spiral designs:
Share It—make an interactive website for exploring spiral designs:
Deploy the Manipulate to the Wolfram Cloud, where anyone with a browser can use it:
Click the link in the output to visit the site.
Tell the world about your creation by sharing the link via email, tweet or other message.