agentleFS
soilmasssoilmass/motion-design-agent/skills/duration/SKILL.md

duration

Skill7 starsChanged 10 months agoMITView on GitHub

Duration and timing tokens from industry standards. Use when selecting animation duration, converting between milliseconds and frames, or comparing timing across design systems. References W3C DTCG, M3, Fluent, and Carbon specifications.

The file

Files
SKILL.md

Duration & Timing

Industry-standard duration tokens with cross-system comparison.

Standards Reference

StandardDocumentation
W3C DTCGdesigntokens.org (duration type)
Material Design 3m3.material.io/styles/motion/easing-and-duration
Fluent 2fluent2.microsoft.design/motion
Carboncarbondesignsystem.com/guidelines/motion

M3 Duration Scale (Primary)

Load from: tokens/duration.tokens.json

TokenValueUse Case
short-150msMicro-feedback, ripples
short-2100msToggles, checkboxes
short-3150msIcons, small elements
short-4200msButtons, chips
medium-1250msCards, list items
medium-2300msDialogs, modals
medium-3350msSheets, drawers
medium-4400msComplex expansions
long-1450msPage transitions
long-2500msHero animations

Selection Guide

MICRO-INTERACTION?     → short-1 to short-2 (50-100ms)
SMALL COMPONENT?       → short-3 to short-4 (150-200ms)
MEDIUM COMPONENT?      → medium-1 to medium-2 (250-300ms)
LARGE TRANSITION?      → medium-3 to medium-4 (350-400ms)
PAGE/NAV CHANGE?       → long-1 to long-2 (450-500ms)

Cross-System Comparison

M3FluentCarbonValue
short-1ultra-fast-50ms
short-2fasterfast-02100-110ms
short-3fastmoderate-01150ms
short-4normal-200ms
medium-1-moderate-02240-250ms
medium-2slow-300ms
medium-4slowerslow-01400ms
long-2ultra-slow-500ms
--slow-02700ms

Frame Conversion

Duration24fps30fps60fps
50ms123
100ms236
150ms459
200ms5612
250ms6815
300ms7918
400ms101224
500ms121530

Implementation

JavaScript

import tokens from '../tokens/duration.tokens.json';

const duration = tokens.motion.duration;
const ms = parseInt(duration['medium-1'].$value); // 250

// Convert to seconds for GSAP
gsap.to('.element', { x: 100, duration: ms / 1000 });

Remotion (frames at 30fps)

const msToFrames = (ms, fps = 30) => Math.round((ms / 1000) * fps);

// medium-1 (250ms) = 8 frames at 30fps
const frames = msToFrames(250, 30);

Dynamic Duration Calculation

Static durations are amateur. Google calculates duration based on context.

Distance-Based Duration

function durationFromDistance(distancePx) {
  const BASE_DURATION = 300; // ms
  const BASE_DISTANCE = 300; // px

  // Square root scaling feels natural
  const scale = Math.sqrt(distancePx / BASE_DISTANCE);
  const duration = BASE_DURATION * scale;

  // Clamp to M3 range
  return Math.max(100, Math.min(500, Math.round(duration)));
}

// Examples:
durationFromDistance(100);  // 173ms
durationFromDistance(300);  // 300ms
durationFromDistance(600);  // 424ms
durationFromDistance(1000); // 500ms (capped)

Area-Based Duration

function durationFromArea(startArea, endArea) {
  const change = Math.abs(endArea - startArea);
  const max = Math.max(startArea, endArea);
  const ratio = change / max;

  const BASE = 250;
  const scale = 1 + (ratio * 0.5);

  return Math.min(500, Math.round(BASE * scale));
}

Platform Multiplier

function platformDuration(baseDuration) {
  const width = typeof window !== 'undefined' ? window.innerWidth : 1920;

  if (width >= 1024) return Math.round(baseDuration * 0.7);  // Desktop: 30% faster
  if (width >= 768) return Math.round(baseDuration * 0.85); // Tablet: 15% faster
  return baseDuration; // Mobile: baseline
}

Enter vs Exit Asymmetry

Google M3 requires exits to be 30% faster than enters.

function asymmetricDurations(baseDuration) {
  return {
    enter: baseDuration,
    exit: Math.round(baseDuration * 0.7)  // 30% faster
  };
}

// Usage:
const { enter, exit } = asymmetricDurations(300);
// enter: 300ms, exit: 210ms

Load ratio from: tokens/sequencing.tokens.json → motion.sequencing.choreography.enter-exit-ratio

See references/duration-by-context.md for contextual selection. See references/frame-conversion.md for all frame rate tables.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.