@editframe/create 0.43.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.js +16 -28
- package/dist/index.js.map +1 -1
- package/dist/skills/editframe-brand-video-generator/README.md +155 -0
- package/dist/skills/editframe-brand-video-generator/SKILL.md +207 -0
- package/dist/skills/editframe-brand-video-generator/references/brand-examples.md +178 -0
- package/dist/skills/editframe-brand-video-generator/references/color-psychology.md +227 -0
- package/dist/skills/editframe-brand-video-generator/references/composition-patterns.md +383 -0
- package/dist/skills/editframe-brand-video-generator/references/editing.md +66 -0
- package/dist/skills/editframe-brand-video-generator/references/emotional-arcs.md +496 -0
- package/dist/skills/editframe-brand-video-generator/references/genre-selection.md +135 -0
- package/dist/skills/editframe-brand-video-generator/references/transition-styles.md +611 -0
- package/dist/skills/editframe-brand-video-generator/references/typography-personalities.md +326 -0
- package/dist/skills/editframe-brand-video-generator/references/video-archetypes.md +86 -0
- package/dist/skills/editframe-brand-video-generator/references/video-fundamentals.md +169 -0
- package/dist/skills/editframe-brand-video-generator/references/visual-metaphors.md +50 -0
- package/dist/skills/editframe-composition/SKILL.md +169 -0
- package/dist/skills/editframe-composition/references/audio.md +483 -0
- package/dist/skills/editframe-composition/references/captions.md +844 -0
- package/dist/skills/editframe-composition/references/composition-model.md +73 -0
- package/dist/skills/editframe-composition/references/configuration.md +403 -0
- package/dist/skills/editframe-composition/references/css-parts.md +105 -0
- package/dist/skills/editframe-composition/references/css-variables.md +640 -0
- package/dist/skills/editframe-composition/references/entry-points.md +810 -0
- package/dist/skills/editframe-composition/references/events.md +499 -0
- package/dist/skills/editframe-composition/references/getting-started.md +259 -0
- package/dist/skills/editframe-composition/references/hooks.md +234 -0
- package/dist/skills/editframe-composition/references/image.md +241 -0
- package/dist/skills/editframe-composition/references/r3f.md +580 -0
- package/dist/skills/editframe-composition/references/render-api.md +484 -0
- package/dist/skills/editframe-composition/references/render-strategies.md +119 -0
- package/dist/skills/editframe-composition/references/render-to-video.md +1101 -0
- package/dist/skills/editframe-composition/references/scripting.md +606 -0
- package/dist/skills/editframe-composition/references/sequencing.md +116 -0
- package/dist/skills/editframe-composition/references/server-rendering.md +753 -0
- package/dist/skills/editframe-composition/references/surface.md +329 -0
- package/dist/skills/editframe-composition/references/text.md +627 -0
- package/dist/skills/editframe-composition/references/time-model.md +99 -0
- package/dist/skills/editframe-composition/references/timegroup-modes.md +102 -0
- package/dist/skills/editframe-composition/references/timegroup.md +457 -0
- package/dist/skills/editframe-composition/references/timeline-root.md +398 -0
- package/dist/skills/editframe-composition/references/transcription.md +47 -0
- package/dist/skills/editframe-composition/references/transitions.md +608 -0
- package/dist/skills/editframe-composition/references/use-media-info.md +357 -0
- package/dist/skills/editframe-composition/references/video.md +506 -0
- package/dist/skills/editframe-composition/references/waveform.md +327 -0
- package/dist/skills/editframe-editor-gui/SKILL.md +152 -0
- package/dist/skills/editframe-editor-gui/references/active-root-temporal.md +657 -0
- package/dist/skills/editframe-editor-gui/references/canvas.md +947 -0
- package/dist/skills/editframe-editor-gui/references/controls.md +366 -0
- package/dist/skills/editframe-editor-gui/references/dial.md +756 -0
- package/dist/skills/editframe-editor-gui/references/editor-toolkit.md +587 -0
- package/dist/skills/editframe-editor-gui/references/filmstrip.md +460 -0
- package/dist/skills/editframe-editor-gui/references/fit-scale.md +772 -0
- package/dist/skills/editframe-editor-gui/references/focus-overlay.md +561 -0
- package/dist/skills/editframe-editor-gui/references/hierarchy.md +544 -0
- package/dist/skills/editframe-editor-gui/references/overlay-item.md +634 -0
- package/dist/skills/editframe-editor-gui/references/overlay-layer.md +429 -0
- package/dist/skills/editframe-editor-gui/references/pan-zoom.md +568 -0
- package/dist/skills/editframe-editor-gui/references/pause.md +397 -0
- package/dist/skills/editframe-editor-gui/references/play.md +370 -0
- package/dist/skills/editframe-editor-gui/references/preview.md +391 -0
- package/dist/skills/editframe-editor-gui/references/resizable-box.md +749 -0
- package/dist/skills/editframe-editor-gui/references/scrubber.md +588 -0
- package/dist/skills/editframe-editor-gui/references/thumbnail-strip.md +566 -0
- package/dist/skills/editframe-editor-gui/references/time-display.md +492 -0
- package/dist/skills/editframe-editor-gui/references/timeline-ruler.md +489 -0
- package/dist/skills/editframe-editor-gui/references/timeline.md +604 -0
- package/dist/skills/editframe-editor-gui/references/toggle-loop.md +618 -0
- package/dist/skills/editframe-editor-gui/references/toggle-play.md +526 -0
- package/dist/skills/editframe-editor-gui/references/transform-handles.md +924 -0
- package/dist/skills/editframe-editor-gui/references/trim-handles.md +725 -0
- package/dist/skills/editframe-editor-gui/references/workbench.md +453 -0
- package/dist/skills/editframe-motion-design/SKILL.md +101 -0
- package/dist/skills/editframe-motion-design/references/0-editframe.md +299 -0
- package/dist/skills/editframe-motion-design/references/1-intent.md +201 -0
- package/dist/skills/editframe-motion-design/references/2-physics-model.md +405 -0
- package/dist/skills/editframe-motion-design/references/3-attention.md +350 -0
- package/dist/skills/editframe-motion-design/references/4-process.md +418 -0
- package/dist/skills/editframe-vite-plugin/SKILL.md +75 -0
- package/dist/skills/editframe-vite-plugin/references/file-api.md +111 -0
- package/dist/skills/editframe-vite-plugin/references/getting-started.md +96 -0
- package/dist/skills/editframe-vite-plugin/references/jit-transcoding.md +91 -0
- package/dist/skills/editframe-vite-plugin/references/local-assets.md +75 -0
- package/dist/skills/editframe-vite-plugin/references/visual-testing.md +136 -0
- package/dist/skills/editframe-webhooks/SKILL.md +126 -0
- package/dist/skills/editframe-webhooks/references/events.md +382 -0
- package/dist/skills/editframe-webhooks/references/getting-started.md +232 -0
- package/dist/skills/editframe-webhooks/references/security.md +418 -0
- package/dist/skills/editframe-webhooks/references/testing.md +409 -0
- package/dist/skills/editframe-webhooks/references/troubleshooting.md +457 -0
- package/dist/templates/html/AGENTS.md +13 -0
- package/dist/templates/react/AGENTS.md +13 -0
- package/dist/utils.js +15 -16
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/tsdown.config.ts +4 -0
- package/dist/detectAgent.js +0 -89
- package/dist/detectAgent.js.map +0 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Timeline Ruler Element
|
|
3
|
+
description: Time ruler with zoom-aware frame markers and time labels for precise timeline navigation in editor interfaces.
|
|
4
|
+
type: reference
|
|
5
|
+
nav:
|
|
6
|
+
parent: "Timeline"
|
|
7
|
+
priority: 14
|
|
8
|
+
api:
|
|
9
|
+
attributes:
|
|
10
|
+
- name: duration-ms
|
|
11
|
+
type: number
|
|
12
|
+
description: Total duration in milliseconds
|
|
13
|
+
- name: fps
|
|
14
|
+
type: number
|
|
15
|
+
default: 30
|
|
16
|
+
description: Frame rate for frame marker display
|
|
17
|
+
- name: content-width
|
|
18
|
+
type: number
|
|
19
|
+
description: Total width of timeline content in pixels
|
|
20
|
+
methods:
|
|
21
|
+
- name: quantizeToFrameTimeMs
|
|
22
|
+
signature: quantizeToFrameTimeMs(timeMs, fps) => number
|
|
23
|
+
description: Round time to nearest frame boundary
|
|
24
|
+
returns: Time in milliseconds aligned to frame boundary
|
|
25
|
+
- name: calculateFrameIntervalMs
|
|
26
|
+
signature: calculateFrameIntervalMs(fps) => number
|
|
27
|
+
description: Calculate duration of one frame
|
|
28
|
+
returns: Frame duration in milliseconds
|
|
29
|
+
- name: calculatePixelsPerFrame
|
|
30
|
+
signature: calculatePixelsPerFrame(frameIntervalMs, pixelsPerMs) => number
|
|
31
|
+
description: Calculate pixel width of one frame at current zoom
|
|
32
|
+
returns: Frame width in pixels
|
|
33
|
+
- name: shouldShowFrameMarkers
|
|
34
|
+
signature: shouldShowFrameMarkers(pixelsPerFrame, minSpacing?) => boolean
|
|
35
|
+
description: Determine if frame markers should be visible at current zoom
|
|
36
|
+
returns: True if frames have enough space to display
|
|
37
|
+
react:
|
|
38
|
+
generate: true
|
|
39
|
+
componentName: TimelineRuler
|
|
40
|
+
importPath: "@editframe/react"
|
|
41
|
+
propMapping:
|
|
42
|
+
duration-ms: durationMs
|
|
43
|
+
content-width: containerWidth
|
|
44
|
+
additionalProps:
|
|
45
|
+
- name: zoomScale
|
|
46
|
+
type: number
|
|
47
|
+
description: Zoom level multiplier
|
|
48
|
+
- name: scrollContainerSelector
|
|
49
|
+
type: string
|
|
50
|
+
description: CSS selector for scroll container element
|
|
51
|
+
- name: scrollContainerRef
|
|
52
|
+
type: React.RefObject<HTMLElement>
|
|
53
|
+
description: Ref to scroll container element for scroll synchronization
|
|
54
|
+
- name: className
|
|
55
|
+
type: string
|
|
56
|
+
description: CSS classes for styling
|
|
57
|
+
nav:
|
|
58
|
+
parent: "Tools"
|
|
59
|
+
priority: 45
|
|
60
|
+
related: ["timeline", "filmstrip"]
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
<!-- html-only -->
|
|
64
|
+
# ef-timeline-ruler
|
|
65
|
+
<!-- /html-only -->
|
|
66
|
+
<!-- react-only -->
|
|
67
|
+
# TimelineRuler
|
|
68
|
+
<!-- /react-only -->
|
|
69
|
+
|
|
70
|
+
Time ruler showing time labels and frame markers. Automatically adapts marker density based on zoom level.
|
|
71
|
+
|
|
72
|
+
<!-- react-only -->
|
|
73
|
+
## Import
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { TimelineRuler } from "@editframe/react";
|
|
77
|
+
```
|
|
78
|
+
<!-- /react-only -->
|
|
79
|
+
|
|
80
|
+
## Basic Usage
|
|
81
|
+
|
|
82
|
+
<!-- html-only -->
|
|
83
|
+
Ruler displays time markers and optional frame markers.
|
|
84
|
+
|
|
85
|
+
```html live
|
|
86
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="ruler-demo">
|
|
87
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
88
|
+
</ef-timegroup>
|
|
89
|
+
<div class="mt-4">
|
|
90
|
+
<div class="h-[24px] bg-gray-900 rounded-t-lg overflow-hidden relative">
|
|
91
|
+
<ef-timeline-ruler
|
|
92
|
+
duration-ms="10000"
|
|
93
|
+
fps="30"
|
|
94
|
+
content-width="400"
|
|
95
|
+
></ef-timeline-ruler>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="p-4 bg-gray-800 rounded-b-lg">
|
|
98
|
+
<ef-controls target="ruler-demo" class="flex gap-4 items-center">
|
|
99
|
+
<ef-toggle-play class="px-3 py-1 bg-blue-600 text-white rounded"></ef-toggle-play>
|
|
100
|
+
<ef-time-display class="text-white font-mono"></ef-time-display>
|
|
101
|
+
</ef-controls>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
```
|
|
105
|
+
<!-- /html-only -->
|
|
106
|
+
<!-- react-only -->
|
|
107
|
+
The ruler is typically used inside Timeline or Filmstrip components, but can be used standalone:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { TimelineRuler } from "@editframe/react";
|
|
111
|
+
|
|
112
|
+
<div className="h-6 bg-gray-900 relative">
|
|
113
|
+
<TimelineRuler
|
|
114
|
+
durationMs={10000}
|
|
115
|
+
fps={30}
|
|
116
|
+
className="w-full h-full"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
```
|
|
120
|
+
<!-- /react-only -->
|
|
121
|
+
|
|
122
|
+
<!-- html-only -->
|
|
123
|
+
## Frame Markers at High Zoom
|
|
124
|
+
|
|
125
|
+
Frame markers appear when zoomed in enough for precision editing.
|
|
126
|
+
|
|
127
|
+
```html live
|
|
128
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="frames-demo">
|
|
129
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" sourcein="0s" sourceout="3s" class="size-full object-contain"></ef-video>
|
|
130
|
+
</ef-timegroup>
|
|
131
|
+
<div class="mt-4 space-y-4">
|
|
132
|
+
<div>
|
|
133
|
+
<div class="text-white text-sm mb-2">Standard zoom - no frame markers:</div>
|
|
134
|
+
<div class="h-[24px] bg-gray-900 rounded-lg overflow-auto">
|
|
135
|
+
<ef-timeline-ruler
|
|
136
|
+
duration-ms="3000"
|
|
137
|
+
fps="30"
|
|
138
|
+
content-width="120"
|
|
139
|
+
></ef-timeline-ruler>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
<div>
|
|
143
|
+
<div class="text-white text-sm mb-2">High zoom - frame markers visible:</div>
|
|
144
|
+
<div class="h-[24px] bg-gray-900 rounded-lg overflow-auto">
|
|
145
|
+
<ef-timeline-ruler
|
|
146
|
+
duration-ms="3000"
|
|
147
|
+
fps="30"
|
|
148
|
+
content-width="600"
|
|
149
|
+
></ef-timeline-ruler>
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
</div>
|
|
153
|
+
```
|
|
154
|
+
<!-- /html-only -->
|
|
155
|
+
|
|
156
|
+
<!-- react-only -->
|
|
157
|
+
## With Custom FPS
|
|
158
|
+
|
|
159
|
+
Show frame markers at different frame rates:
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
{/* 24fps cinema */}
|
|
163
|
+
<TimelineRuler
|
|
164
|
+
durationMs={10000}
|
|
165
|
+
fps={24}
|
|
166
|
+
className="w-full h-6"
|
|
167
|
+
/>
|
|
168
|
+
|
|
169
|
+
{/* 60fps high frame rate */}
|
|
170
|
+
<TimelineRuler
|
|
171
|
+
durationMs={10000}
|
|
172
|
+
fps={60}
|
|
173
|
+
className="w-full h-6"
|
|
174
|
+
/>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## With Scroll Container
|
|
178
|
+
|
|
179
|
+
Sync ruler with scrollable timeline:
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
import { useRef } from "react";
|
|
183
|
+
import { TimelineRuler } from "@editframe/react";
|
|
184
|
+
|
|
185
|
+
export const ScrollableRuler = () => {
|
|
186
|
+
const scrollRef = useRef<HTMLDivElement>(null);
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<div className="flex flex-col">
|
|
190
|
+
{/* Ruler */}
|
|
191
|
+
<div className="h-6 bg-gray-900">
|
|
192
|
+
<TimelineRuler
|
|
193
|
+
durationMs={30000}
|
|
194
|
+
fps={30}
|
|
195
|
+
scrollContainerRef={scrollRef}
|
|
196
|
+
className="w-full h-full"
|
|
197
|
+
/>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
{/* Scrollable content */}
|
|
201
|
+
<div
|
|
202
|
+
ref={scrollRef}
|
|
203
|
+
className="overflow-x-auto h-64 bg-gray-800"
|
|
204
|
+
>
|
|
205
|
+
<div style={{ width: '3000px' }}>
|
|
206
|
+
{/* Timeline content */}
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
```
|
|
213
|
+
<!-- /react-only -->
|
|
214
|
+
|
|
215
|
+
## Used in Timeline
|
|
216
|
+
|
|
217
|
+
<!-- html-only -->
|
|
218
|
+
Ruler is automatically included in `ef-timeline` and `ef-filmstrip`.
|
|
219
|
+
|
|
220
|
+
```html live
|
|
221
|
+
<ef-timegroup mode="contain" class="w-[720px] h-[480px] bg-black" id="timeline-ruler">
|
|
222
|
+
<ef-video src="https://assets.editframe.com/bars-n-tone.mp4" class="size-full object-contain"></ef-video>
|
|
223
|
+
<ef-text class="absolute bottom-4 left-4 text-white text-2xl">
|
|
224
|
+
Timeline with Ruler
|
|
225
|
+
</ef-text>
|
|
226
|
+
</ef-timegroup>
|
|
227
|
+
<div class="mt-4 h-[300px] bg-gray-900 rounded-lg overflow-hidden">
|
|
228
|
+
<ef-timeline target="timeline-ruler"></ef-timeline>
|
|
229
|
+
</div>
|
|
230
|
+
```
|
|
231
|
+
<!-- /html-only -->
|
|
232
|
+
<!-- react-only -->
|
|
233
|
+
Ruler is automatically included in Timeline:
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import { Timeline, Timegroup, Video } from "@editframe/react";
|
|
237
|
+
|
|
238
|
+
{/* Timeline includes ruler by default */}
|
|
239
|
+
<Timeline className="w-full h-96" />
|
|
240
|
+
|
|
241
|
+
{/* Hide ruler if not needed */}
|
|
242
|
+
<Timeline
|
|
243
|
+
showRuler={false}
|
|
244
|
+
className="w-full h-96"
|
|
245
|
+
/>
|
|
246
|
+
```
|
|
247
|
+
<!-- /react-only -->
|
|
248
|
+
|
|
249
|
+
## Adaptive Time Labels
|
|
250
|
+
|
|
251
|
+
Time labels automatically adjust spacing based on zoom level. The ruler shows appropriate intervals:
|
|
252
|
+
|
|
253
|
+
- **High zoom** — 0.1s, 0.25s, 0.5s intervals
|
|
254
|
+
- **Medium zoom** — 1s, 2s, 5s intervals
|
|
255
|
+
- **Low zoom** — 10s, 30s, 60s intervals
|
|
256
|
+
|
|
257
|
+
Labels format as "Xs" or "X.Xs" depending on precision needed.
|
|
258
|
+
|
|
259
|
+
## Frame Marker Behavior
|
|
260
|
+
|
|
261
|
+
Frame markers appear when:
|
|
262
|
+
1. Zoom level is high enough (each frame is at least 5px wide by default)
|
|
263
|
+
2. FPS is set (defaults to 30fps)
|
|
264
|
+
|
|
265
|
+
Frame markers are lighter than time markers to distinguish hierarchy.
|
|
266
|
+
|
|
267
|
+
At very high zoom, you can see individual frame boundaries for frame-accurate editing.
|
|
268
|
+
|
|
269
|
+
<!-- react-only -->
|
|
270
|
+
```tsx
|
|
271
|
+
import { useState } from "react";
|
|
272
|
+
import { TimelineRuler } from "@editframe/react";
|
|
273
|
+
|
|
274
|
+
export const ZoomableRuler = () => {
|
|
275
|
+
const [zoom, setZoom] = useState(0.04);
|
|
276
|
+
|
|
277
|
+
return (
|
|
278
|
+
<div>
|
|
279
|
+
<div className="mb-2 flex gap-2">
|
|
280
|
+
<button onClick={() => setZoom(zoom * 2)}>Zoom In</button>
|
|
281
|
+
<button onClick={() => setZoom(zoom / 2)}>Zoom Out</button>
|
|
282
|
+
<span className="text-sm">
|
|
283
|
+
{zoom >= 0.1 ? "Frame markers visible" : "Zoom in to see frames"}
|
|
284
|
+
</span>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
<div className="h-6 bg-gray-900">
|
|
288
|
+
<TimelineRuler
|
|
289
|
+
durationMs={10000}
|
|
290
|
+
fps={30}
|
|
291
|
+
zoomScale={zoom * 1000}
|
|
292
|
+
className="w-full h-full"
|
|
293
|
+
/>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
);
|
|
297
|
+
};
|
|
298
|
+
```
|
|
299
|
+
<!-- /react-only -->
|
|
300
|
+
|
|
301
|
+
## Virtualization
|
|
302
|
+
|
|
303
|
+
The ruler uses canvas virtualization for performance with long timelines:
|
|
304
|
+
- Only renders visible region plus buffer
|
|
305
|
+
- Maximum canvas width of 2000px
|
|
306
|
+
- Smooth scrolling with 200px buffer on each side
|
|
307
|
+
|
|
308
|
+
This allows timelines of any length without performance degradation.
|
|
309
|
+
|
|
310
|
+
<!-- react-only -->
|
|
311
|
+
```tsx
|
|
312
|
+
{/* Handles long timelines efficiently */}
|
|
313
|
+
<TimelineRuler
|
|
314
|
+
durationMs={600000} // 10 minutes
|
|
315
|
+
fps={30}
|
|
316
|
+
className="w-full h-6"
|
|
317
|
+
/>
|
|
318
|
+
```
|
|
319
|
+
<!-- /react-only -->
|
|
320
|
+
|
|
321
|
+
<!-- html-only -->
|
|
322
|
+
## Helper Functions
|
|
323
|
+
|
|
324
|
+
The module exports utility functions for working with frames:
|
|
325
|
+
|
|
326
|
+
### quantizeToFrameTimeMs
|
|
327
|
+
|
|
328
|
+
Round time to the nearest frame boundary.
|
|
329
|
+
|
|
330
|
+
```typescript
|
|
331
|
+
import { quantizeToFrameTimeMs } from '@editframe/elements';
|
|
332
|
+
|
|
333
|
+
const fps = 30;
|
|
334
|
+
const rawTime = 1234; // 1.234 seconds
|
|
335
|
+
const frameTime = quantizeToFrameTimeMs(rawTime, fps);
|
|
336
|
+
// Returns: 1233 (exactly 37 frames at 30fps)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
### calculateFrameIntervalMs
|
|
340
|
+
|
|
341
|
+
Get the duration of one frame.
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { calculateFrameIntervalMs } from '@editframe/elements';
|
|
345
|
+
|
|
346
|
+
const fps = 30;
|
|
347
|
+
const frameDuration = calculateFrameIntervalMs(fps);
|
|
348
|
+
// Returns: 33.333... (1000ms / 30fps)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### calculatePixelsPerFrame
|
|
352
|
+
|
|
353
|
+
Calculate pixel width of a frame at current zoom.
|
|
354
|
+
|
|
355
|
+
```typescript
|
|
356
|
+
import { calculatePixelsPerFrame } from '@editframe/elements';
|
|
357
|
+
|
|
358
|
+
const frameIntervalMs = 33.33; // 30fps
|
|
359
|
+
const pixelsPerMs = 0.2; // zoom level
|
|
360
|
+
const frameWidth = calculatePixelsPerFrame(frameIntervalMs, pixelsPerMs);
|
|
361
|
+
// Returns: 6.666 pixels per frame
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### shouldShowFrameMarkers
|
|
365
|
+
|
|
366
|
+
Determine if frame markers should be visible.
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import { shouldShowFrameMarkers } from '@editframe/elements';
|
|
370
|
+
|
|
371
|
+
const pixelsPerFrame = 6.5;
|
|
372
|
+
const shouldShow = shouldShowFrameMarkers(pixelsPerFrame);
|
|
373
|
+
// Returns: true (frame is wider than 5px minimum)
|
|
374
|
+
|
|
375
|
+
const pixelsPerFrame = 2;
|
|
376
|
+
const shouldShow = shouldShowFrameMarkers(pixelsPerFrame);
|
|
377
|
+
// Returns: false (frame too narrow to display markers)
|
|
378
|
+
```
|
|
379
|
+
<!-- /html-only -->
|
|
380
|
+
|
|
381
|
+
## CSS Custom Properties
|
|
382
|
+
|
|
383
|
+
Ruler appearance uses theme variables:
|
|
384
|
+
|
|
385
|
+
```css
|
|
386
|
+
ef-timeline-ruler {
|
|
387
|
+
--ef-color-text-muted: #9ca3af;
|
|
388
|
+
--ef-color-border-subtle: #6b7280;
|
|
389
|
+
}
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
<!-- react-only -->
|
|
393
|
+
## Custom Styling
|
|
394
|
+
|
|
395
|
+
Style the ruler appearance:
|
|
396
|
+
|
|
397
|
+
```tsx
|
|
398
|
+
<TimelineRuler
|
|
399
|
+
durationMs={20000}
|
|
400
|
+
fps={30}
|
|
401
|
+
className="w-full h-8 bg-gradient-to-b from-gray-900 to-gray-800"
|
|
402
|
+
style={{
|
|
403
|
+
'--ef-color-text-muted': 'rgb(156, 163, 175)',
|
|
404
|
+
'--ef-color-border-subtle': 'rgb(107, 114, 128)',
|
|
405
|
+
} as React.CSSProperties}
|
|
406
|
+
/>
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
## Time Label Format
|
|
410
|
+
|
|
411
|
+
Time labels automatically adjust format:
|
|
412
|
+
|
|
413
|
+
```tsx
|
|
414
|
+
<div className="space-y-4">
|
|
415
|
+
{/* Short duration: shows decimals */}
|
|
416
|
+
<TimelineRuler durationMs={5000} fps={30} className="w-full h-6 bg-gray-900" />
|
|
417
|
+
|
|
418
|
+
{/* Medium duration: shows seconds */}
|
|
419
|
+
<TimelineRuler durationMs={30000} fps={30} className="w-full h-6 bg-gray-900" />
|
|
420
|
+
|
|
421
|
+
{/* Long duration: shows minutes */}
|
|
422
|
+
<TimelineRuler durationMs={300000} fps={30} className="w-full h-6 bg-gray-900" />
|
|
423
|
+
</div>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
## Marker Visibility
|
|
427
|
+
|
|
428
|
+
Frame markers only appear when there's enough space:
|
|
429
|
+
|
|
430
|
+
```tsx
|
|
431
|
+
import { TimelineRuler } from "@editframe/react";
|
|
432
|
+
|
|
433
|
+
<div className="space-y-4">
|
|
434
|
+
<div>
|
|
435
|
+
<p className="text-sm mb-1">Zoomed out - only time labels</p>
|
|
436
|
+
<TimelineRuler
|
|
437
|
+
durationMs={30000}
|
|
438
|
+
fps={30}
|
|
439
|
+
zoomScale={40}
|
|
440
|
+
className="w-full h-6 bg-gray-900"
|
|
441
|
+
/>
|
|
442
|
+
</div>
|
|
443
|
+
|
|
444
|
+
<div>
|
|
445
|
+
<p className="text-sm mb-1">Zoomed in - time labels and frame markers</p>
|
|
446
|
+
<TimelineRuler
|
|
447
|
+
durationMs={30000}
|
|
448
|
+
fps={30}
|
|
449
|
+
zoomScale={200}
|
|
450
|
+
className="w-full h-6 bg-gray-900"
|
|
451
|
+
/>
|
|
452
|
+
</div>
|
|
453
|
+
</div>
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
## Responsive Ruler
|
|
457
|
+
|
|
458
|
+
Ruler adapts to container width:
|
|
459
|
+
|
|
460
|
+
```tsx
|
|
461
|
+
<div className="w-full max-w-4xl mx-auto">
|
|
462
|
+
<TimelineRuler
|
|
463
|
+
durationMs={15000}
|
|
464
|
+
fps={30}
|
|
465
|
+
className="w-full h-6 bg-gray-900 rounded"
|
|
466
|
+
/>
|
|
467
|
+
</div>
|
|
468
|
+
```
|
|
469
|
+
<!-- /react-only -->
|
|
470
|
+
|
|
471
|
+
## Usage Context
|
|
472
|
+
|
|
473
|
+
The ruler is typically used as part of larger timeline components rather than standalone. It automatically reads zoom and scroll state from timeline context.
|
|
474
|
+
|
|
475
|
+
<!-- html-only -->
|
|
476
|
+
For custom timeline implementations, provide `duration-ms`, `fps`, and `content-width` explicitly.
|
|
477
|
+
<!-- /html-only -->
|
|
478
|
+
|
|
479
|
+
## Notes
|
|
480
|
+
|
|
481
|
+
- Ruler is typically used within Timeline or Filmstrip
|
|
482
|
+
- Frame markers appear automatically at high zoom levels
|
|
483
|
+
- Uses virtualized rendering for performance with long timelines
|
|
484
|
+
- Time labels adjust format based on duration and zoom
|
|
485
|
+
- Minimum spacing prevents marker overlap
|
|
486
|
+
<!-- react-only -->
|
|
487
|
+
- Syncs with scroll container via ref or selector
|
|
488
|
+
<!-- /react-only -->
|
|
489
|
+
- Canvas-based rendering for smooth performance
|