agentskills.codes
BA

Battle Animations & Timing

Guide for maintaining and adding new battle animations, focusing on specific sequence timing (Entry, Hits, Faints) and the data-driven Animation Framework.

Install

mkdir -p .claude/skills/battle-animations-timing && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14208" && unzip -o skill.zip -d .claude/skills/battle-animations-timing && rm skill.zip

Installs to .claude/skills/battle-animations-timing

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for maintaining and adding new battle animations, focusing on specific sequence timing (Entry, Hits, Faints) and the data-driven Animation Framework.
155 charsno explicit “when” trigger

About this skill

Battle Animations & Timing Guide

Description

This guide ensures that all battle animations (Entry, Attack hits, Fainting, Switching) maintain the authentic G/S feel by respecting specific sequence timings and CSS class interactions.

Animation Framework Overview

The project uses a data-driven, registry-based animation system spread across three files in js/anim/:

  • AnimFramework (anim_framework.js) — The engine. Registers and plays named animation sequences. Contains the SVG shape library, formation patterns, and sprite movement presets.
  • registry/ — Directory containing modular animation definitions (registered on load):
    • core.js: Basic type effects (fx-fire, etc.), recovery, status, and system animations.
    • elemental.js: Fire, Water, Electric, Grass, and Ice moves.
    • physical.js: Normal, Fighting, Flying, and Poison moves.
    • nature.js: Ground and Rock moves.
    • steel.js: Steel and Metal-themed moves.
    • mystic.js: Psychic, Ghost, Dark, Dragon, and multi-elemental moves.
  • BattleAnims (animations.js) — High-level API the rest of the codebase calls. Delegates to the framework.

[!IMPORTANT] Check the Directory First: Always check docs/ANIMATION_DIRECTORY.json before implementing a new animation to avoid duplicates. Since this file is large, do not read the whole file. Instead, use the grep_search tool to search for the specific elemental type (e.g. "FIRE": {) and only read the relevant section. If you add a new animation, you must manually update this JSON file in the appropriate type category.

How Move Animations are Triggered

When a move deals damage, the pipeline automatically checks for a registered animation:

resolveSingleHit → applyDamage(target, amount, type, moveName)
  → triggerHitAnim(target, type, moveName)
    ① Check (Pre-Anim): Are conditions valid? (Substitute, Status, Type Immunity)
        → If invalid, log "But it failed!" and STOP.
    ② Check: AnimFramework.has(moveName)  → e.g. 'flamethrower'
    ③ Check: AnimFramework.has('fx-'+type) → e.g. 'fx-fire'
    ④ Fallback: classic inline (screen flash + sprite shake)

Move names are auto-normalized: 'FLAMETHROWER''flamethrower', 'ICE BEAM''ice-beam'.

The skipAnim Pattern

If a unique move in MOVE_DEX plays its own animation in onHit (e.g. Explosion), its internal moveData should set skipAnim: true to prevent the pipeline from replaying it.

const moveData = { name: 'EXPLOSION', type: 'normal', power: 250, category: 'physical', skipAnim: true };

Available Step Types (20 total)

Audio & Control

TypeParametersDescription
sfxsound, wait?Play a sound effect
crycry?, target?('attacker'/'defender'), wait?Play a Pokémon cry
waitmsPause execution
callbackfn(ctx)Run arbitrary async function
parallelsteps: [...]Run multiple steps concurrently
sequencesteps: [...]Run multiple steps in order. Essential for nesting inside parallel

Visual Effects (Scene-level)

TypeParametersDescription
screenFxclass, durationApply CSS class to scene (auto-removes). Uses classes like fx-fire, fx-water, etc.
flashcolor, duration, opacity?, parent?Full-scene color overlay that fades out
tiltangle, durationRotate the battle scene and spring back. Great for heavy impacts
bgColorcolor, durationTemporarily flash the background to a solid color (e.g. dark for Ghost moves)
inverttarget('scene'|'attacker'|'defender'), durationInvert colors of the entire scene or a single sprite
waveintensity, duration, speedWavy screen distortion using skew transforms. Psychic/Confusion vibe
cssClassel, class, duration, persist?Toggle any CSS class on any element

Sprite Effects

TypeParametersDescription
spriteShaketarget, duration, flipped?, skipIfInvisible?Shake + flicker a sprite (the classic "hit" reaction)
spriteSilhouettetarget, color, hold?, duration, follow?Solid-color silhouette. Follows sprite moves by default.
spriteGhosttarget, color, hold?, durationStationary silhouette snapshot (ghosting effect).
spriteWavetarget, intensity, duration, speedWiggle/distortion on a specific sprite.
spriteMovetarget, preset OR x,y,duration,easingMove a sprite with preset templates or custom coordinates
spriteMetallictarget, duration, color?Applies a grayscale metallic filter to the sprite and animates a shiny gradient wipe across it. Supports 'gold'/'bronze' tints.
moveel, x, y, duration, easing?, reset?Translate any arbitrary DOM element

Projectiles & Particles

TypeParametersDescription
streamfrom, to, count, interval, spread, travelTime, size, color, outline?, scaleStart?, scaleEnd?, fade?, svgShape?Continuous particle flow. Core system for fire, ice, water moves. Supports SVG shapes as particles
beamfrom, to, className?, duration, width, height, beamStyles?Single projectile from → to
volleyfrom, to, count, interval, travelTime, projectile: {width, height, styles}Rapid-fire pixel projectiles (e.g. Pin Missile)
particlesposition, count, spread, className?, duration, particleStyles?Burst of impact particles at a position

Shapes & Overlays

TypeParametersDescription
overlaytarget, shape, color, outline?, width, height, duration, animation, count?, spread?Render an SVG shape on top of a target with entrance animation
formationtarget, pattern|points, particleSize, color, outline?, shape?, duration, stagger?Spawn particles arranged in a predefined pattern (e.g. Fire Blast 大 kanji)
orbittarget, shape, radiusX, radiusY, count, speed, duration, color, outline?, yOffset?Rotate shapes in an elliptical path around a target. Simulates depth with z-index and scaling.
spawnparent?, className, styles?, tag?, text?, duration, waitAfter?Create a temporary DOM element

Developer Experience: Autocomplete & Types

The project includes a robust JSDoc-based type system in js/types.js and a jsconfig.json file. This provides full IntelliSense for animation sequences in VS Code.

How to use:

When calling AnimFramework.register(name, steps), the steps array is automatically typed.

  • As you type { type: '...' }, VS Code will suggest all 20+ available step types.
  • Once a type is chosen, VS Code will suggest the specific parameters (e.g. sound for sfx, preset for spriteMove).

Key Types:

  • AnimStep: Defines the required/optional fields for every animation step.
  • AnimationEngine: Typed interface for AnimFramework.
  • BattleEngine: Typed interface for the main Battle orchestrator.

SVG Shape Library

13 built-in 8-bit pixel-art shapes available for overlay, formation, and stream steps:

ShapeUse Case
lightningThunderbolt striking down
fireFlame particles, fire overlays
waterWater drop effects
leafGrass/nature moves
starImpact sparks, sparkle effects
clawSlash / claw attack overlays
fistFighting-type punch impacts
skullGhost-type effects
spiralPsychic / confusion effects
birdFlying-type movements / Confusion
duckConfusion effect
rockGround/Rock type impacts
sparkleHealing / Status restore effects
musicSing / Sonic moves
heartAttract / Charm effects
eyeGlare / Mean Look effects
bubbleWater / Sleep effects
zzzSleep status
dropSweat drop / Splash
shieldProtect / Defense effects
wallReflect / Light Screen
angerAnger point / frustration vein pop
jaw-topUpper set of fangs
jaw-bottomLower set of fangs
bite(Deprecated) Combined biting teeth
kickHigh Jump Kick / kicking attacks
poisonToxic sludge drop, poison attacks
snowHail / Blizzard snowflakes
gustWhirlwind / hurricane tornadoes
spikeSpikes / caltrop hazards

Formation Patterns

Predefined point layouts for the formation step. Each is an array of {x, y} offsets from the target's center.

PatternShapeBest For
fireBlast大 kanjiFire Blast's iconic symbol
cross+ shapeCross-shaped impacts
ring○ circleEncircling effects
xShape✕ shapeX-shaped hits

Custom formations — pass your own points array:

{ type: 'formation', target: 'defender',
    points: [{x:0,y:-10}, {x:-10,y:0}, {x:10,y:0}, {x:0,y:10}],
    particleSize: 6, color: '#ff0000', duration: 500
}

Sprite Movement Presets

The spriteMove step provides quick-access movement templates. Direction is automatically adjusted for player vs. enemy side.

PresetMotionDurationBest For
lungeForward toward opponent, back240msPhysical attacks (Tackle, Slash)
dodgeQuick sidestep away160msEvasion, Agility
jumpHop up and down240msBounce, aerial moves
recoilPush backward300msTake-down, recoil damage
chargeRush forward aggressively400msHyper Beam charge, Skull Bash
slamUp then slam down310msBody Slam, Earthquake
floatGentle rise and

Content truncated.

Search skills

Search the agent skills registry