Time for action – animating a radar screen
To pull off a radar pattern, we'll rotate straight lines around a circle, but we'll need to draw upon our earlier work with colors to make the animated effect. Let's create a new stack of blocks by performing the following steps:
- Let's initialize our starting point with the following blocks:
- clear
- go to x: () y: ()
- set pen shade to (50)
- pen down
- Then add a forever block. We want to repeat the following set of blocks:
- set pen size to (1)
- turn (90) degrees
- set pen color to (15)
- move (60) steps
- move (60) steps
- set pen size to (1)
- set pen color to (101)
- move (-120) steps
- turn (1) degrees
- When you run the script, you should get a pattern similar to the following screenshot. As the pattern repeats, the thin, dark lines create a movement around the center point while the background color remains solid. It's a relatively noisy pattern.
Tip
To speed up the pattern, use the turbo mode by shift-clicking the green flag.
- Now let's experiment...