Since the attached image did not get attached, here is the code:
ximport("colors")
size(400, 400)
colors.shadow(dx = WIDTH/20, dy = WIDTH/40, alpha=0.5, blur=WIDTH/300)
fill(1, 0, 0)
rect(180, 180, 40, 40)
Looks like the dx and dy arguments to colors.shadow are interpreted as device pixels, so they don't scale along with the zoom level.
While I could see some use for this behavior, in general it seems wrong since everything else about a NodeBox graphic does scale when zoomed. So this seems like a bug.
The shadow offset works independently from any transformations (e.g. if you set the horizontal offset to 10 it is always 10, regardless of the zoom level or the scale of the shape).
For a number of reasons onscreen objects (ovals, images, shadows, ...) are not supposed to know about the current zoom level so I can't make an official fix for this.
However, if this is essential to you, get the latest version of the Colors library, in which you can do:
colors = ximport("colors") colors.ZOOM_SHADOWS = True colors.shadow(dx=20, dy=20) oval(100, 100, 100, 100)Be warned though, if you export your artwork in this way, shadows will use the current zoom level of the screen, whereas the rest of the composition will not. So before exporting you need to set colors.ZOOM_SHADOWS back to False.
Shadows & on-screen scaling
Posted by Eric Olivier LEBIGOT on Aug 19, 2008When zooming down an image with shadows, the shadows move with respect to their attached image. The result is that the zoomed down image looks different.
In the attached example, the shadow is normally partly under the central square.