useCurrentScale()v4.0.125
With this hook, you can retrieve the scale factor of the canvas.
Useful for if you want to measure DOM nodes.
In the Studio, it will correspond to the zoom level - the value is 1
if the zoom is at 100%.
In the Player, it will correspond to the scale that is needed to fit the video canvas in the Player.
MyComp.tsxtsx
import {Sequence ,useCurrentScale } from "remotion";constMyVideo = () => {constscale =useCurrentScale ();return <div >The current scale is {scale }</div >;};
MyComp.tsxtsx
import {Sequence ,useCurrentScale } from "remotion";constMyVideo = () => {constscale =useCurrentScale ();return <div >The current scale is {scale }</div >;};
If you are outside of a Remotion context, the hook will throw an error.
If you want to ignore the fact that you are outside of a Remotion context, you can pass true
as the first argument to the hook.
The hook will always return 1
in this case.
MyComp.tsxtsx
import {useCurrentScale } from "remotion";constMyRegularReactComponent = () => {constscale =useCurrentScale ({dontThrowIfOutsideOfRemotion : true });return <div >The current scale is {scale }</div >;};
MyComp.tsxtsx
import {useCurrentScale } from "remotion";constMyRegularReactComponent = () => {constscale =useCurrentScale ({dontThrowIfOutsideOfRemotion : true });return <div >The current scale is {scale }</div >;};