qtxie/notes

DRAW shadow

qtxie opened this issue · 0 comments

qtxie commented
shadow off|<offset> <blur> <spread> <color> inset
  • off: Turn off the shadow effect.
  • offset (pair! required): The offset of the shadow.
  • blur (integer! optional): The blur radius. The higher the number, the more blurred the shadow will be.
  • spread (integer! optional): The spread radius. A positive value increases the size of the shadow, a negative value decreases the size of the shadow.
  • color (tuple! optional): The color of the shadow. The default value is the text color.
  • inset (optional): Changes the shadow from an outer shadow (outset) to an inner shadow.

The shadow command define a shadow effect (or several) which apply to the following draw commands. For examples:

view [
    base 300x300 white draw [
        fill-pen white
        shadow 5x10 18 255.0.0
        box 50x50 150x150
    ]
]

This will draw a box with red shadow:
image

You can also apply multiple shadow effects.

view [
    base 300x300 white draw [
        fill-pen white
        shadow 5x10 18 255.0.0
        shadow -5x-10 18 0.0.255
        box 50x50 150x150
    ]
]

image

The shadow effect will apply to all the shapes until it's turned off.

view [
    base 300x300 white draw [
        fill-pen white
        shadow 5x10 18 255.0.0
        shadow -5x-10 18 0.0.255
        box 30x30 130x130            ;-- has shadow
        circle 200x200 50            ;-- has shadow
        shadow off
        box 200x30 280x110           ;-- no shadow
    ]
]