Documentation / Restrict / restrictFromFunctionExtension
restrictFromFunctionExtension()
ts
function restrictFromFunctionExtension<Animating>(restriction): Extension<Animating>;
Defined in: ../../extensions/src/restrict.ts:51
Type Parameters
Animating
Animating
extends Animatable
<unknown
>
Parameters
restriction
(state
) => void
A function which takes in a proxy to the local animation state which you can directly set to in order to collapse the allowed state of the animation.
Returns
Extension
<Animating
>
an extension which calls the restriction function
Example
ts
function restrictToWholeNumbersExtension() {
return restrictFromFunctionExtension(local => {
for (const key in local) local[key] = Math.round(local[key])
})
}
*