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.tsxtsximport {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 avoid this error and return a default scale, you can pass an options object with the property dontThrowIfOutsideOfRemotion set to true.
In this case, the hook will return 1.
MyComp.tsxtsximport {useCurrentScale } from "remotion";constMyRegularReactComponent = () => {constscale =useCurrentScale ({dontThrowIfOutsideOfRemotion : true });return <div >The current scale is {scale }</div >;};