mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-07 18:26:17 +00:00
* feat(studio): runtime hooks — global time compiler + keyframe runtime Add the runtime bridge layer: global time compilation (tween % → clip %), soft reload after mutations, runtime keyframe preview, and keyframe commit helper. * feat(studio): runtime hooks — global time compiler + keyframe runtime Add the runtime bridge layer: global time compilation (tween % → clip %), soft reload after mutations, runtime keyframe preview, and keyframe commit helper. * feat(studio): keyframe cache + commit hooks Add hooks for keyframe cache population (tween → clip-relative %), mutation dispatch, keyframe snapping, and audio beat detection. * feat(studio): timeline UI — dopesheet diamonds + keyboard nav Add dopesheet strip with diamond keyframe indicators, timeline property rows, keyboard navigation (J/Shift+J/Delete/K), and feature gate (STUDIO_KEYFRAMES_ENABLED defaults to false). * feat(studio): design panel — arc controls + ease curve + stagger Add arc path controls (curviness slider, auto-rotate), motion path SVG overlay, ease curve visualization, stagger controls, and expanded animation card. Includes border-radius editor dependency from #1217. * feat(studio): gesture recording core Add gesture recording engine with RAF sampling, modifier key property mapping (Shift→rotationXY, Alt→rotation, Cmd→opacity), Ramer-Douglas-Peucker simplification, and ghost trail SVG overlay. * fix(studio): keyframe drag + recording bug bash 21 fixes: capture GSAP base at drag start, translate:none before gsap.set, skip reapplyPathOffsets for GSAP elements, clamp recording seek, _auto flag for 100% keyframes, overlay flash fix, block edits during recording. * feat(studio): keyframe integration wiring + docs Wire App.tsx recording orchestration, TimelineToolbar K/R buttons, PropertyPanel per-property diamonds, shortcuts panel, toast notifications, and keyframes guide documentation. All gated on STUDIO_KEYFRAMES_ENABLED (default false).
26 lines
872 B
TypeScript
26 lines
872 B
TypeScript
import { useState, useCallback, useRef } from "react";
|
|
import { useMountEffect } from "./useMountEffect";
|
|
import type { AppToast } from "../utils/studioHelpers";
|
|
|
|
export function useToast() {
|
|
const [appToast, setAppToast] = useState<AppToast | null>(null);
|
|
const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
|
|
const showToast = useCallback((message: string, tone: AppToast["tone"] = "error") => {
|
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
setAppToast({ message, tone });
|
|
timerRef.current = setTimeout(() => setAppToast(null), 4000);
|
|
}, []);
|
|
|
|
useMountEffect(() => () => {
|
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
});
|
|
|
|
const dismissToast = useCallback(() => {
|
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
setAppToast(null);
|
|
}, []);
|
|
|
|
return { appToast, showToast, dismissToast };
|
|
}
|