Spec Registry
Help your agents use open-source better. Learn more.
Find usage specs for your project’s dependencies
- Author
- tessl
- Last updated
- Spec files
npm-svelte
Describes: npm/svelte
- Description
- A cybernetically enhanced web application framework that compiles to highly optimized JavaScript with reactive state management and component-based architecture.
- Author
- tessl
- Last updated
easing.md docs/
1# Easing Functions23Svelte provides a comprehensive collection of easing functions for smooth animations and transitions. These functions are mathematical curves that control the rate of change during animations.45## Capabilities67### Linear Easing89The simplest easing function that provides constant rate of change.1011```typescript { .api }12/**13* Linear easing function - constant rate of change14* @param t - Time progress from 0 to 115* @returns Eased value from 0 to 116*/17function linear(t: number): number;18```1920### Back Easing2122Easing functions that go slightly beyond their target before settling.2324```typescript { .api }25/**26* Back-in easing - starts slow with slight reverse motion27* @param t - Time progress from 0 to 128* @returns Eased value29*/30function backIn(t: number): number;3132/**33* Back-out easing - ends slow with slight overshoot34* @param t - Time progress from 0 to 135* @returns Eased value36*/37function backOut(t: number): number;3839/**40* Back-in-out easing - combines backIn and backOut41* @param t - Time progress from 0 to 142* @returns Eased value43*/44function backInOut(t: number): number;45```4647### Bounce Easing4849Easing functions that simulate bouncing motion.5051```typescript { .api }52/**53* Bounce-in easing - bouncing motion at the start54* @param t - Time progress from 0 to 155* @returns Eased value56*/57function bounceIn(t: number): number;5859/**60* Bounce-out easing - bouncing motion at the end61* @param t - Time progress from 0 to 162* @returns Eased value63*/64function bounceOut(t: number): number;6566/**67* Bounce-in-out easing - bouncing motion at start and end68* @param t - Time progress from 0 to 169* @returns Eased value70*/71function bounceInOut(t: number): number;72```7374### Circular Easing7576Easing functions based on circular motion curves.7778```typescript { .api }79/**80* Circular-in easing - accelerating circular motion81* @param t - Time progress from 0 to 182* @returns Eased value83*/84function circIn(t: number): number;8586/**87* Circular-out easing - decelerating circular motion88* @param t - Time progress from 0 to 189* @returns Eased value90*/91function circOut(t: number): number;9293/**94* Circular-in-out easing - combines circIn and circOut95* @param t - Time progress from 0 to 196* @returns Eased value97*/98function circInOut(t: number): number;99```100101### Cubic Easing102103Easing functions based on cubic curves (most commonly used).104105```typescript { .api }106/**107* Cubic-in easing - slow start, accelerating108* @param t - Time progress from 0 to 1109* @returns Eased value110*/111function cubicIn(t: number): number;112113/**114* Cubic-out easing - fast start, decelerating (most popular)115* @param t - Time progress from 0 to 1116* @returns Eased value117*/118function cubicOut(t: number): number;119120/**121* Cubic-in-out easing - slow start and end, fast middle122* @param t - Time progress from 0 to 1123* @returns Eased value124*/125function cubicInOut(t: number): number;126```127128### Elastic Easing129130Easing functions that simulate elastic or spring-like motion.131132```typescript { .api }133/**134* Elastic-in easing - elastic motion at the start135* @param t - Time progress from 0 to 1136* @returns Eased value137*/138function elasticIn(t: number): number;139140/**141* Elastic-out easing - elastic motion at the end142* @param t - Time progress from 0 to 1143* @returns Eased value144*/145function elasticOut(t: number): number;146147/**148* Elastic-in-out easing - elastic motion at start and end149* @param t - Time progress from 0 to 1150* @returns Eased value151*/152function elasticInOut(t: number): number;153```154155### Exponential Easing156157Easing functions based on exponential curves.158159```typescript { .api }160/**161* Exponential-in easing - very slow start, sharp acceleration162* @param t - Time progress from 0 to 1163* @returns Eased value164*/165function expoIn(t: number): number;166167/**168* Exponential-out easing - sharp start, gradual deceleration169* @param t - Time progress from 0 to 1170* @returns Eased value171*/172function expoOut(t: number): number;173174/**175* Exponential-in-out easing - combines expoIn and expoOut176* @param t - Time progress from 0 to 1177* @returns Eased value178*/179function expoInOut(t: number): number;180```181182### Quadratic Easing183184Easing functions based on quadratic curves.185186```typescript { .api }187/**188* Quadratic-in easing - gentle acceleration189* @param t - Time progress from 0 to 1190* @returns Eased value191*/192function quadIn(t: number): number;193194/**195* Quadratic-out easing - gentle deceleration196* @param t - Time progress from 0 to 1197* @returns Eased value198*/199function quadOut(t: number): number;200201/**202* Quadratic-in-out easing - gentle acceleration and deceleration203* @param t - Time progress from 0 to 1204* @returns Eased value205*/206function quadInOut(t: number): number;207```208209### Quartic Easing210211Easing functions based on quartic (fourth power) curves.212213```typescript { .api }214/**215* Quartic-in easing - stronger acceleration than cubic216* @param t - Time progress from 0 to 1217* @returns Eased value218*/219function quartIn(t: number): number;220221/**222* Quartic-out easing - stronger deceleration than cubic223* @param t - Time progress from 0 to 1224* @returns Eased value225*/226function quartOut(t: number): number;227228/**229* Quartic-in-out easing - combines quartIn and quartOut230* @param t - Time progress from 0 to 1231* @returns Eased value232*/233function quartInOut(t: number): number;234```235236### Quintic Easing237238Easing functions based on quintic (fifth power) curves.239240```typescript { .api }241/**242* Quintic-in easing - very strong acceleration243* @param t - Time progress from 0 to 1244* @returns Eased value245*/246function quintIn(t: number): number;247248/**249* Quintic-out easing - very strong deceleration250* @param t - Time progress from 0 to 1251* @returns Eased value252*/253function quintOut(t: number): number;254255/**256* Quintic-in-out easing - combines quintIn and quintOut257* @param t - Time progress from 0 to 1258* @returns Eased value259*/260function quintInOut(t: number): number;261```262263### Sine Easing264265Easing functions based on sine wave curves.266267```typescript { .api }268/**269* Sine-in easing - smooth sine wave acceleration270* @param t - Time progress from 0 to 1271* @returns Eased value272*/273function sineIn(t: number): number;274275/**276* Sine-out easing - smooth sine wave deceleration277* @param t - Time progress from 0 to 1278* @returns Eased value279*/280function sineOut(t: number): number;281282/**283* Sine-in-out easing - smooth sine wave acceleration and deceleration284* @param t - Time progress from 0 to 1285* @returns Eased value286*/287function sineInOut(t: number): number;288```289290## Usage Examples291292```typescript293import { cubicOut, elasticOut, bounceIn } from "svelte/easing";294import { tweened } from "svelte/motion";295import { fly, fade } from "svelte/transition";296297// Use with tweened values298const progress = tweened(0, {299duration: 800,300easing: cubicOut301});302303// Use with transitions304// transition:fly={{ y: -20, duration: 300, easing: elasticOut }}305// transition:fade={{ duration: 400, easing: sineInOut }}306307// Use with custom animations308function customAnimation(node, { easing = cubicOut }) {309return {310duration: 600,311easing,312css: (t) => `transform: scale(${t}); opacity: ${t}`313};314}315```316317## Types318319```typescript { .api }320type EasingFunction = (t: number) => number;321```322323## Choosing Easing Functions324325- **cubicOut**: Most versatile, great for UI interactions326- **cubicInOut**: Good for looping animations327- **elasticOut**: Playful, attention-grabbing effects328- **bounceOut**: Fun, energetic animations329- **sineInOut**: Subtle, organic feeling330- **backOut**: Slight overshoot adds polish331- **linear**: Use sparingly, feels mechanical332- **expoOut**: Dramatic, cinematic effects