smithery/verekia

smooth-interpolation

Animate values smoothly using exponential decay instead of linear interpolation.

Installation

$ npx skills add smithery/verekia --skill smooth-interpolation

Also in this package

Other skills from smithery/verekia · top by installs.

npx skills add smithery/verekia

Browse all from smithery/verekia

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,498 B
  • docs SUMMARY.md 108 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Smooth Interpolation

Animate values smoothly using exponential decay instead of linear interpolation.

Technique

Use exponential smoothing formulas to interpolate between current and target values. This creates a natural easing effect that's frame-rate independent.

Key Concepts

  • Exponential smoothing: (target - current) (1 - Math.exp(-speed dt))
  • Exponential decay: target + (current - target) Math.exp(-decay dt)
  • Both formulas produce the same result with different parameters
  • Speed/decay values from 1-25 work well
  • Frame-rate independent due to delta time usage

Usage

const addSmoothExp = (current: number, target: number, speed: number, dt: number) =>
  (target - current) * (1 - Math.exp(-speed * dt))

const expDecay = (current: number, target: number, decay: number, dt: number) =>
  target + (current - target) * Math.exp(-decay * dt)

useFrame((_, delta) => {
  mesh.position.x += addSmoothExp(mesh.position.x, targetX, 3, delta)
  // or
  mesh.position.x = expDecay(mesh.position.x, targetX, 3, delta)
})

References


This skill is part of verekia's r3f-gamedev.