Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Show a Graphics object with simulated background shadow
ResourceFunction["ShadowShow"][gr] displays 2D Graphics with a simulated background shadow. |
"ShadowBlur" | 10 | how many pixels to blur the shadow cast |
"ShadowBrightness" | 0. | the GrayLevel of the Shadow cast |
"SunAltitude" | 75 Degree | the elevation angle of the light source casting the shadow |
"SunAzimuth" | 210 Degree | the direction of light creating the shadow |
"Location" | Here | the GeoLocation used to calculate automatic altitude and azimuth |
"Time" | Now | the time used to calculate automatic altitude and azimuth |
"FacingDirection" | 0 (North) | the direction the viewer faces the Graphics |
Background | Automatic | the Background color |
You can control how sharp the shadow is with "ShadowBlur" which is defined in pixels of shadow image:
In[4]:= | ![]() |
Out[4]= | ![]() |
The intensity of the shadow is controlled with "ShadowBrightness":
In[5]:= | ![]() |
Out[5]= | ![]() |
The angle and length of the shadow are controlled by "SunAltitude" and "SunAzimuth":
In[6]:= | ![]() |
Out[6]= | ![]() |
If "SunAltitude" and "SunAzimuth" are set to Automatic, their values are calculated by the real sun position at "Location" and "Time" which default to Here and Now:
In[7]:= | ![]() |
Out[7]= | ![]() |
If the sun is below the horizon or in front of the viewer (who faces north by default) then no shadow is produced:
In[8]:= | ![]() |
Out[8]= | ![]() |
The viewer can change their orientation to face south to create a shadow:
In[9]:= | ![]() |
Out[9]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License