measuring-dom-nodes
community[skill]
Measuring DOM element dimensions in Remotion
$
/plugin install claude-code-video-toolkitdetails
Measuring DOM nodes in Remotion
Remotion applies a scale() transform to the video container, which affects values from getBoundingClientRect(). Use useCurrentScale() to get correct measurements.
Measuring element dimensions
import { useCurrentScale } from "remotion";
import { useRef, useEffect, useState } from "react";
export const MyComponent = () => {
const ref = useRef<HTMLDivElement>(null);
const scale = useCurrentScale();
const [dimensions, setDimensions] = useState({ width: 0, height: 0 });
useEffect(() => {
if (!ref.current) return;
const rect = ref.current.getBoundingClientRect();
setDimensions({
width: rect.width / scale,
height: rect.height / scale,
});
}, [scale]);
return <div ref={ref}>Content to measure</div>;
};
technical
- github
- digitalsamba/claude-code-video-toolkit
- stars
- 928
- license
- MIT
- contributors
- 1
- last commit
- 2026-04-20T10:52:53Z
- file
- .claude/skills/remotion-official/rules/measuring-dom-nodes.md