arrow_back Spiral Effect
In this add-on, you will create a spiral movement effect.
Choose a costume to spiral.
This example creates a new costume by adding an apple to the paint editor.
Next, program the costume to appear as part of the Studio Logo.
Follow the same process as in the previous videos to make a new clone.
Add “switch costume” and “create clone” blocks.
Duplicate an “if” statement, change the value to the number of the new costume, and delete the code inside.
Next, program the costume to spiral.
“Show” the sprite so that you can test the movement.
A spiral is similar to the movement of a circle, except that the distance the sprite moves decreases each time.
Program the sprite to move in a circle using a “repeat” loop, a “move” block, and a “turn right” block.
Next, create a spiral.
Make a variable, and name it “spiral.”
Drag out a “set Spiral” block, and place it above the repeat loop.
Change the value in the block to something larger than 30 so that the sprite makes a full circle.
This example uses 40.
If the repeat loop is greater than the value in the “spiral” variable, the spiral will reverse!
Drag out a “spiral” variable, and place it inside the value of the repeat loop.
This makes the sprite go in a circle.
Add another “spiral” variable inside the “move” block.
This sets the distance the clone will move each time.
Drag out a “change spiral by” block, place it in the repeat loop, and make the value negative 1.
This will decrease the movement each time the loop runs, making the sprite move in gradually smaller circles.
Test it out by clicking the stack.
The clone should spiral.
Next, make the sprite start and end in a specific direction.
Use a “go to xy” block to set the starting position.
This example moves the costume to the top left of the stage.
Use a “set rotation style” block to make the clone turn the way you want it to.
This example uses “all around” so that the clone completely rotates.
Use the “point in direction” block to help determine where the sprite will spin first.
This example sets the dropdown value to 90 degrees.
Place this block under the repeat loop to make the sprite end its motion in an upright position.
Test it by clicking the stack.
Continue to tinker with the values to make the spiral bigger or smaller.
If you can’t make the clone end up in the right place Use a “glide” block to move it to the correct position.
Place this new code stack inside the new “if” block.
Test it to make sure everything works.
Now, it’s your turn.
Create a new costume to clone.
Make a spiral by creating a “spiral” variable and using “move,” “turn,” “change by,” “set to” and “repeat” blocks.
Use motion blocks to set the starting location, rotation style, and final destination of the clone.