spotlightStrength

Returns how strongly a spotlight is holding the environment, from 0 when none is running to 1 at full hold.

@internote/canvas-sdk/reactFunction
On this page
import { spotlightStrength } from '@internote/canvas-sdk/react';

A spotlight is purely the dimming: everything else on the environment goes down around its content, which is left at full strength. It comes on over the first fifth of its window, holds, and releases over the last fifth. A surface multiplies the strength by SPOTLIGHT_DIM to get how much to lower the rest.

#Signature

(nodes: CompiledNode[], runtime: EnvironmentContext["animation"]): number

#Parameters

nodes
The environment's children, searched at any depth.
runtime
The environment's animation runtime, ctx.animation.

#Example

const dim = 1 - spotlightStrength(children, ctx.animation) * (1 - SPOTLIGHT_DIM);
<g opacity={inSpotlight ? 1 : dim}>{marks}</g>

Declared in packages/canvas-sdk/src/react/attention.tsx:161.

Last updated