shadowComposite

A tinted shadow behind the child.

shadowComposite(opts: {
    coverage: (params: RttFilterParams) => Expr
    color: PropRef
    intensity: ArgSpec
    cutout: PropRef
}): OverlayStage

Import effects from shaders/std and use effects.blurs.shadowComposite.

coverage is the soft silhouette from silhouetteCoverage, tinted with color (a color prop) at intensity (0–1) and placed under the child. cutout is a boolean prop with compileTime: true; when true only the shadow shows, with the child's shape punched out of it.

Parameters

NameTypeNotes
opts`{
coverage: (params: RttFilterParams) => Expr
color: PropRef
intensity: ArgSpec
cutout: PropRef

}` | |

Example

effect: gatherStack(childTap(), [shadowComposite({coverage: silhouetteCoverage({at: shadowOffset({angle: p('angle'), distance: p('distance')}), blur: p('blur')}), color: p('color'), intensity: p('intensity'), cutout: p('cutout')})])

See also

  • childTap — The child's own color at this pixel, unchanged.
  • shadowOffset — The coordinate a shadow reads the child's silhouette from: distance away in the compass direction angle.
  • silhouetteCoverage — A soft copy of the child's alpha silhouette: a number per pixel from 0 to 1.

Used by

DropShadow