Documentation / Bound / setupBoundsLayer
setupBoundsLayer()
ts
function setupBoundsLayer<Animating>(
anim,
bounds,
mask): BoundsLayer<Animating>;Defined in: ../../extensions/src/bound.ts:86
Sets up a bounds layer for an animation. Allows for the animation's bounds to be dynamically changed.
Type Parameters
Animating
Animating extends Animatable<unknown>
Parameters
anim
Animation<Animating>
bounds
Bounds<Animating>
mask
Partial<Mask<Animating>> = {}
Returns
BoundsLayer<Animating>
Example
ts
const anim = createAnimation({a: 0, b: 0}, getLinearInterp(1))
const bounds = {
lower: { a: 0, b: 0 },
upper: { a: 1, b: 1 }
}
const {unsub, updateBounds} = initializeBounds(anim, bounds)
updateBounds({lower: {a: 0.5}})