Skip to content

Glow and Beat

How to make a shape give off light, and how to make a shape, or its light, beat. Other changes over time are on the Animation page.


glow

draw circle lamp at 200, 150 having radius 40, glow "gold"

Gives the shape a soft light all round it, in the colour you choose. The shape itself is drawn as it was. Glows show best on a dark drawing:

Canvas night having width 400, length 300, fill "midnightblue"
draw circle lamp at 120, 150 having radius 40, fill "orange", glow "gold"
draw text sign at 210, 165 having content "OPEN", size 40, color "pink", glow "hotpink"

Every shape can glow, and so can words. A shape with parts glows as a whole: the light goes round the whole face, not round each eye.


borderglow

draw polygon sign at 200, 150 having sides 6, size 100, borderglow "deepskyblue"

Makes the outline glow, like a neon sign: the line turns bright and its light spills to both sides of it. The inside stays as it was.

Canvas night having width 400, length 300, fill "midnightblue"
draw polygon sign at 120, 150 having sides 6, size 110, fill "navy", color "deepskyblue", thickness 4, borderglow "deepskyblue"
draw circle ring at 290, 150 having radius 50, fill none, color "gold", thickness 3, borderglow "gold"

A shape can have a glow and a borderglow at the same time. A shape's parts glow with its borderglow too.


glowsize

draw circle lamp at 200, 150 having glow "gold", glowsize 60

How far the light reaches from the shape's edge. Without it, a glow reaches 30.

Canvas night having width 400, length 300, fill "midnightblue"
draw circle small at 100, 150 having radius 30, fill "orange", glow "gold", glowsize 10
draw circle big at 280, 150 having radius 30, fill "orange", glow "gold", glowsize 70

Changing a glow

A glow changes like any other property, at once or over time. none takes it away:

Canvas night having width 400, length 300, fill "midnightblue"
draw circle lamp at 200, 150 having radius 40, fill "orange", glow "gold"
lamp.glow = "red" in 2 seconds
lamp.glowsize = 60 in 2 seconds
when lamp is clicked {
  lamp.glow = none
}

A glow is light, not part of the shape: it doesn't count when shapes touch, and clicking the light doesn't click the shape.


beat

beat heart

Makes the shape beat once: it grows a little and comes back to its size. Put it in a forever to keep it beating, with a wait between beats:

Canvas room having width 400, length 300
draw circle heart at 200, 150 having radius 50, fill "red"
forever {
  beat heart
  wait 0.6 seconds
}

Choose how many beats, how big and how long, in any mix:

beat heart 3 times
beat heart by 1.5
beat heart in 1 second
beat heart 3 times by 1.5 in 2 seconds
  • 3 times: beats in a row.
  • by 1.5: how big each beat gets, here one and a half times as big. Without it, a beat grows by 1.2.
  • in 2 seconds: how long the whole line takes. Here that's three beats in 2 seconds. Without it, each beat takes 0.4 seconds.

A beat always comes back to where it started, so it works together with other changes:

Canvas room having width 400, length 300
draw circle balloon at 200, 150 having radius 20, fill "tomato"
together {
  grow balloon by 3 in 3 seconds
  beat balloon 6 times in 3 seconds
}

The balloon grows three times as big, beating as it goes.


Beating a glow

beat lamp.glow makes the light beat, not the shape: it flares out and settles back. beat sign.borderglow does the same for an outline's glow.

Canvas night having width 400, length 300, fill "midnightblue"
draw circle heart at 200, 150 having radius 40, fill "red", glow "red"
forever {
  together {
    beat heart
    beat heart.glow
  }
  wait 0.6 seconds
}

by works here too: beat lamp.glow by 3 makes the light reach three times as far. Without it, the light reaches twice as far.

Rules:

  • The amount after by must be more than 0, and the number of times a whole number.
  • A shape's beat, the clicks on it and its touching all use the shape's real size, not its glow.