Experience with non-standard shadows for WebGL and React Native.
Customers reaching out to me when standard APIs didn't work as well.
In 2007, work on box-shadow in CSS started (released in 2010)
box-shadow:
inset 0 -3em 3em rgba(0, 0, 0, 0.1),
0 0 0 2px rgb(255, 255, 255),
0.3em 0.3em 1em rgba(0, 0, 0, 0.3);
Element
.shadow(
color: .primary,
radius: CGFloat(radius),
x: CGFloat(offset),
y: CGFloat(offset),
)
<View
android:elevation="2dp"
>
<View
android:elevation="2dp"
android:shape="CircleShape | RectangleShape | RoundedCornerShape"
android:clip="true | false"
android:ambientColor="@android:color/primary"
android:spotColor="@android:color/secondary"
>
Making the same UI-kit
for 3 platforms
is hard.
Shadows in 2025 still
look Β«flatΒ» and restricted,
especially on Android and iOS.
Shadows as a filter are supported
in browsers ONLY.
Shadows for every platform β it's a compromise between design and performance from 15 years ago.
Let's look at the GPU pipeline
Let's take a look at the Tech Assignment
SDF β this is a function that returns the distance to the closest object edge.
-1 β inside
0 β on edge
1 β outside
float sdRoundedBox( in vec2 p, in vec2 b, in vec4 r )
{
r.xy = (p.x>0.0)?r.xy : r.zw;
r.x = (p.y>0.0)?r.x : r.y;
vec2 q = abs(p)-b+r.x;
return min(max(q.x,q.y),0.0) + length(max(q,0.0)) - r.x;
}
Vector Feathering β like SDF but with vectors instead of distance.