mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-13 13:23:31 +08:00
New skill: - remotion-video-creation: 29 domain-specific Remotion rules covering 3D/Three.js, animations, audio, captions, charts, compositions, fonts, GIFs, Lottie, measuring, sequencing, tailwind, text animations, timing, transitions, trimming, and video embedding. Ported from personal skills. Restored: - autonomous-agent-harness/SKILL.md (was in commit but missing from worktree) - lead-intelligence/ (full directory restored from branch commit) Updated: - manifests/install-modules.json: added remotion-video-creation to media-generation - README.md + AGENTS.md: synced counts to 139 skills Catalog validates: 30 agents, 60 commands, 139 skills.
36 lines
974 B
Markdown
36 lines
974 B
Markdown
---
|
|
name: measuring-dom-nodes
|
|
description: Measuring DOM element dimensions in Remotion
|
|
metadata:
|
|
tags: measure, layout, dimensions, getBoundingClientRect, scale
|
|
---
|
|
|
|
# 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
|
|
|
|
```tsx
|
|
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>;
|
|
};
|
|
```
|
|
|