css-animations
heygen-com/hyperframes
CSS keyframe animations with deterministic seeking for HyperFrames preview and rendering.
What is css-animations?
Adapter patterns for CSS animations in HyperFrames that enable seekable keyframe motion. Use for decorative loops, shimmer, glow, masks, and simple element-level motion with fixed duration and iteration count.
- Seeks CSS keyframe animations through the HyperFrames css runtime adapter
- Falls back to negative animation-delay pausing in environments without WAAPI-backed CSS animation handles
- Discovers elements with computed animation-name and synchronizes their timing to clip data-start and data-duration
- Supports staggered animations using CSS custom properties to avoid keyframe duplication
- Validates animation compositions with lint and validate commands
How to install css-animations
npx skills add https://github.com/heygen-com/hyperframes --skill css-animations- HyperFrames installed and initialized
- Elements placed in DOM before runtime initialization
- Finite animation-duration and animation-iteration-count values
How to use css-animations
- 1.Add data-start, data-duration, and data-track-index attributes to animated elements
- 2.Define animation-name, animation-duration, animation-timing-function, animation-iteration-count, and animation-fill-mode in CSS
- 3.Use animation-fill-mode: both to hold seeked states before and after active motion
- 4.For staggered animations, use CSS custom properties (--i) with animation-delay: calc(var(--i) * offset)
- 5.Run npx hyperframes lint and npx hyperframes validate to verify animation compositions
Use cases
- Decorative pulse rings and entrance animations with known repeat counts
- Staggered dot-pop or sequential element animations using animation-delay
- Shimmer, glow, grain, and mask effects on background layers
- Subtle parallax motion on non-layout properties
- Simple one-element animations where a full JavaScript timeline is excessive
- HyperFrames video composition authors
- Motion designers working with CSS-only animations
- Developers building deterministic, seekable video previews
- Teams avoiding JavaScript timelines for simple decorative motion
css-animations FAQ
Use CSS animations for simple repeated motifs, decorative motion, and single-element animations with fixed duration. Use GSAP for complex scene choreography and sequenced multi-element timing.
Only if your browser exposes seekable WAAPI-backed CSS animation handles. Otherwise, use a finite iteration-count covering the visible duration to enable fallback negative-delay seeking.
Prefer transform and opacity. Avoid layout properties like top, left, width, or height as they trigger expensive reflows. Do not animate properties that depend on hover, focus, scroll, or media queries.
Set data-start to the clip start time and data-duration to the clip duration. The adapter uses these to seek the animation to the correct frame during preview and rendering.
Use CSS custom properties (--i) on child elements and set animation-delay: calc(var(--i) * offset) to create sequential timing without duplicating keyframes.
Full instructions (SKILL.md)
Source of truth, from heygen-com/hyperframes.
name: css-animations description: CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.
CSS Animations for HyperFrames
HyperFrames can seek CSS keyframe animations through its css runtime adapter. Use this for simple repeated motifs, background motion, shimmer, glow, masks, and non-sequenced decoration.
For scene choreography, GSAP is usually clearer. CSS animations work best when the motion belongs to one element and has a fixed duration.
Contract
- Put the animated element in the DOM before runtime initialization finishes.
- Give timed elements a
data-startvalue so local animation time matches the clip. - Use finite
animation-durationandanimation-iteration-countbecause the negative-delay fallback cannot represent unbounded duration in environments without WAAPI-backed CSS animations. - Prefer
animation-fill-mode: bothso seeked states hold before and after active motion. - Avoid wall-clock JavaScript, hover-triggered state, and class toggles that depend on user events.
The adapter discovers elements with computed animation-name, seeks their browser Animation handles when available, and falls back to pausing with negative animation-delay.
Basic Pattern
<div
id="pulse-ring"
class="clip pulse-ring"
data-start="0"
data-duration="4"
data-track-index="2"
></div>
<style>
.pulse-ring {
width: 280px;
height: 280px;
border: 4px solid rgba(255, 255, 255, 0.7);
border-radius: 50%;
animation-name: pulse-ring;
animation-duration: 1200ms;
animation-timing-function: cubic-bezier(0.2, 0, 0, 1);
animation-iteration-count: 3;
animation-fill-mode: both;
}
@keyframes pulse-ring {
from {
opacity: 0;
transform: scale(0.82);
}
35% {
opacity: 1;
}
to {
opacity: 0;
transform: scale(1.18);
}
}
</style>
Stagger Pattern
Use CSS custom properties to avoid duplicating keyframes:
<div class="clip dots" data-start="1" data-duration="3" data-track-index="3">
<span style="--i: 0"></span>
<span style="--i: 1"></span>
<span style="--i: 2"></span>
</div>
<style>
.dots span {
display: inline-block;
width: 18px;
height: 18px;
margin-right: 10px;
border-radius: 50%;
background: currentColor;
animation: dot-pop 900ms ease-out both;
animation-delay: calc(var(--i) * 120ms);
}
@keyframes dot-pop {
from {
opacity: 0;
transform: translateY(18px) scale(0.75);
}
to {
opacity: 1;
transform: translateY(0) scale(1);
}
}
</style>
Good Uses
- Decorative loops with a known repeat count.
- Mask, glow, shimmer, grain, and subtle parallax layers.
- Simple one-element entrances where a full JS timeline would be excessive.
Avoid
- Infinite CSS animations unless you have verified the browser exposes seekable WAAPI-backed CSS animation handles. Prefer a finite iteration count covering the visible duration.
- Animating layout properties like
top,left,width, orheightwhen transforms work. - Relying on hover, focus, scroll, or media queries to trigger render-critical motion.
- Changing animation classes after startup unless another deterministic timeline controls that change.
Validation
After editing CSS animation compositions:
npx hyperframes lint
npx hyperframes validate
Credits And References
- HyperFrames adapter source:
packages/core/src/runtime/adapters/css.ts. - MDN CSS animation documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/animation
- MDN
animation-fill-mode: https://developer.mozilla.org/en-US/docs/Web/CSS/animation-fill-mode
Related skills
More from heygen-com/hyperframes and the wider catalog.
hyperframes
Router and entry skill for video authoring—renders video from HTML with intent-based workflow selection.
hyperframes-cli
CLI for HyperFrames video composition: scaffold, lint, validate, render locally or on AWS Lambda.
hyperframes-registry
Install and wire reusable blocks and components into HyperFrames compositions via registry.
remotion-to-hyperframes
Port existing Remotion (React) video compositions to HyperFrames HTML—one-way translation only.
hyperframes-media
Audio and media engine for HyperFrames: TTS, background music, sound effects, transcription, captions, and background removal.
gsap
GSAP animation reference for HyperFrames compositions with timelines, easing, and performance optimization.