Use similar_functions tool to get all functions that handle animations and transitions.
I'll use the similar_functions tool to find all functions that handle animations and transitions in the project.
Tool Call: Run MCP tool similar_functions
Status: Completed
Found 19 similar functions:
- slide
- Path: /packages/svelte/src/transition/index.js:108-150
- Summary: Here's a summary of the
slidefunction:
The function creates a sliding transition animation for DOM elements. It accepts a node element and optional parameters including delay, duration, easing function, and axis direction ('x' or 'y'). The function calculates various CSS properties (height/width, padding, margin, and border) and returns a transition configuration object that gradually animates these properties to create a smooth sliding effect. It includes a development warning for potentially incompatible display values.
Default parameters:
- delay: 0
- duration: 400ms
- easing: cubic_out
- axis: 'y'
- flip
- Path: /packages/svelte/src/animate/index.js:13-58
- Summary: Here's a summary of the
flipfunction:
The function implements the FLIP (First, Last, Invert, Play) animation technique to smoothly animate an element between two positions. It takes a DOM element, initial and final position data (as DOMRect objects), and optional animation parameters. The function calculates the necessary transforms to create a smooth transition, accounting for transform origins, parent transforms, and zoom levels. It returns an animation configuration object with delay, duration, easing, and a CSS transform function that handles the actual animation interpolation.
Key features:
- Supports custom delay, duration, and easing
- Handles transform origins and existing transforms
- Accounts for zoom levels and parent transforms
- Returns a configuration compatible with animation systems
- fade
- Path: /packages/svelte/src/transition/index.js:62-70
- Summary: Here's a summary of the
fadefunction:
The fade function creates a transition animation that smoothly changes an element's opacity. It takes an HTML element and optional parameters (delay, duration, and easing function) as input. The function calculates the opacity transition based on the element's current opacity value and returns a configuration object used for the animation. This is commonly used for fade-in and fade-out effects in user interfaces.
Default values:
- delay: 0ms
- duration: 400ms
- easing: linear function
- animate
- Path: /packages/svelte/src/internal/client/dom/elements/transitions.js:321-477
- Summary: Here's a summary of the
animatefunction:
This function handles element animations with support for both intro and outro transitions. It accepts:
- An HTML element to animate
- Animation configuration (or a function that returns config)
- A counterpart animation (for bidirectional transitions)
- A target value (1 for intro, 0 for outro)
- A completion callback
Key features:
- Supports deferred transitions through function-based configuration
- Handles CSS keyframe animations
- Manages animation timing, delays, and easing
- Provides tick callbacks for custom animation logic
- Includes abort, deactivate, and reset capabilities
- Handles bidirectional transitions between states
- Works around browser-specific issues (e.g., Safari overflow bug)
The function returns an Animation object with methods to control the animation's lifecycle.
- scale
- Path: /packages/svelte/src/transition/index.js:159-177
- Summary: Here's a summary for the
scalefunction:
The scale function creates a transition animation that simultaneously adjusts an element's scale and opacity. It accepts an HTML element and optional parameters for customizing the animation (delay, duration, easing, start scale, and start opacity). The function calculates the transition from the provided starting values to the element's default values (for 'in' animations) or vice versa (for 'out' animations), returning a configuration object that defines how the animation should be executed.
Parameters:
node: The DOM element to animateparams: Optional configuration object with animation parametersdelay: Animation delay (default: 0)duration: Animation duration (default: 400)easing: Easing function (default: cubic_out)start: Starting scale value (default: 0)opacity: Starting opacity value (default: 0)
Returns: A transition configuration object containing delay, duration, easing, and a CSS transform function.
- fly
- Path: /packages/svelte/src/transition/index.js:79-97
- Summary: Here's a summary for the
flyfunction:
The fly function creates a transition animation that moves an element along x and y coordinates while adjusting its opacity. It accepts a DOM element and optional parameters for delay, duration, easing function, x/y coordinates, and opacity. The function returns a transition configuration object that defines how the element should animate between its starting and ending positions, with customizable timing and motion effects.
Default values:
- delay: 0ms
- duration: 400ms
- easing: cubic-out
- x: 0
- y: 0
- opacity: 0
- animation
- Path: /packages/svelte/src/internal/client/dom/elements/transitions.js:83-171
- Summary: Here's a summary of the
animationfunction:
This function manages animations for elements within keyed {#each} blocks in Svelte. It creates or updates an animation manager that handles element transitions during DOM reconciliation. The manager tracks element positions, applies animations when elements move, and handles temporary style fixes to ensure smooth animations. It includes methods to:
- Measure element positions
- Apply animations based on position changes
- Fix element positions during transitions
- Restore original element styles after animations
The function takes three parameters:
element: The DOM element to animateget_fn: A function that returns animation configurationget_params: An optional function for additional animation parameters
- pause_effect
- Path: /packages/svelte/src/internal/client/reactivity/effects.js:527-537
- Summary: Here's a summary for the
pause_effectfunction:
The function handles the graceful pausing of block effects, particularly during transitions. Instead of immediate destruction, it:
- Pauses the effect and its child elements
- Manages any outro transitions
- Destroys the effect only after transitions complete
- Executes an optional callback
This approach ensures smooth visual transitions while maintaining DOM integrity.
- crossfade
- Path: /packages/svelte/src/transition/index.js:233-300
- Summary: Here's a summary of the
crossfadefunction:
The crossfade function creates a pair of transition functions (send and receive) for animating elements between different states. It's particularly useful for handling element transitions in UI frameworks like Svelte.
Key features:
- Creates coordinated transitions between elements using matching keys
- Handles both position transformation and fade effects
- Supports custom duration, delay, and easing
- Provides fallback transition for unmatched elements
- Uses element bounding rectangles to calculate transition paths
- Maintains internal maps to track elements being sent and received
The function returns a tuple of two transition functions: one for sending elements and one for receiving them. Each transition function handles the animation of elements between their original and target positions while managing their opacity.
- run_out_transitions
- Path: /packages/svelte/src/internal/client/reactivity/effects.js:543-553
- Summary: Here's a summary for the
run_out_transitionsfunction:
This function executes a series of transition "out" animations and runs a callback function when all transitions are complete. It takes an array of transition managers and a callback function as parameters. If there are transitions to run, it executes each transition's "out" method and decrements a counter, calling the callback once all transitions finish. If there are no transitions, it immediately executes the callback function.
- bounceInOut
- Path: /packages/svelte/src/easing/index.js:67-69
- Summary: Here's a summary for the
bounceInOutfunction:
Creates a bounce easing effect that starts slow, speeds up, then slows down again (both in and out). Takes a time parameter t between 0 and 1, and returns a transformed value that creates a bouncing animation effect. The function combines both bounce-in and bounce-out effects, splitting the animation at the midpoint (t=0.5).
- tweened
- Path: /packages/svelte/src/motion/tweened.js:90-160
- Summary: Here's a summary of the
tweenedfunction:
The tweened function creates a special Svelte store that enables smooth transitions between values over time. It takes an initial value and optional configuration defaults as parameters. The function returns an object with three methods:
set: Updates the store value with animated transitionsupdate: Modifies the value using a callback functionsubscribe: Subscribes to store changes
The animation behavior can be customized with options like:
delay: Time before animation startsduration: Length of the animationeasing: Easing function for the animationinterpolate: Function to interpolate between values
Note: This function is deprecated in favor of using the Tween API from svelte/motion.
- blur
- Path: /packages/svelte/src/transition/index.js:38-53
- Summary: Here's a summary for the
blurfunction:
A transition function that creates a blur effect animation by simultaneously adjusting an element's blur filter and opacity. It accepts an element and optional parameters (delay, duration, easing, blur amount, and opacity level) to customize the animation. Returns a transition configuration object compatible with Svelte's transition system.
- AnimateDirective
- Path: /packages/svelte/src/compiler/phases/3-transform/client/visitors/AnimateDirective.js:11-28
- Summary: Here's a summary for the
AnimateDirectivefunction:
/**
* Processes an animation directive by creating and pushing an animation call to the component's after_update lifecycle.
* The function handles both cases where the animation expression is present or null, and ensures the animation is
* applied after bind:this operations.
*
* @param {AST.AnimateDirective} node - The animation directive AST node
* @param {ComponentContext} context - The component compilation context
*/This summary captures the main purpose of the function: handling animation directives in a component's compilation process, and its key behaviors of processing the animation expression and scheduling the animation in the component's lifecycle.
- draw
- Path: /packages/svelte/src/transition/index.js:186-210
- Summary: Here's a summary for the
drawfunction:
The draw function creates an SVG stroke animation that reveals or hides paths like a snake moving through a tube. It takes an SVG element (that must have a getTotalLength method) and optional parameters for customizing the animation (delay, speed, duration, and easing). The function calculates the appropriate stroke length, adjusts for stroke line caps, and returns a transition configuration object with CSS properties for the animation effect.
Key features:
- Supports both "in" and "out" transitions
- Works with SVG elements like
<path>and<polyline> - Allows customization of animation timing and easing
- Automatically adjusts for stroke line cap styles
- tick
- Path: /packages/svelte/tests/animation-helpers.js:26-35
- Summary: Here's a summary for the
tickfunction:
This function handles animation frame updates by processing registered animations and tick callbacks. It takes a timestamp parameter, updates a global time reference, performs a synchronous flush, and then executes all registered animation updates and tick callbacks with the current time.
Parameters:
time(number): The current timestamp for this animation frame
- tick_spring
- Path: /packages/svelte/src/motion/spring.js:23-57
- Summary: Here's a summary for the
tick_springfunction:
/**
* Calculates the next value in a spring animation based on physics principles.
* Handles numeric values, dates, arrays, and objects. For numbers and dates,
* applies spring physics (stiffness, damping, mass) to animate between values.
* Recursively processes arrays and objects by applying the spring calculation
* to each element/property.
*
* @template T
* @param {TickContext} ctx - Animation context containing physics parameters
* @param {T} last_value - Previous value in the animation
* @param {T} current_value - Current value in the animation
* @param {T} target_value - Target value to animate towards
* @returns {T} The next value in the spring animation sequence
* @throws {Error} If the value type cannot be animated with springs
*/
This summary captures the main purpose of the function, its handling of different data types, and the physics-based animation approach it uses.
- pause_effects
- Path: /packages/svelte/src/internal/client/dom/blocks/each.js:71-103
- Summary: Here's a summary of the
pause_effectsfunction:
This function coordinates the pausing and cleanup of multiple effects in an each block. It handles two scenarios:
- For controlled anchors (elements inside a single DOM element), it performs a fast-path cleanup by clearing the parent element's content.
- For uncontrolled cases, it manages transitions and systematically removes items from the map while maintaining proper linking.
Parameters:
state: EachState objectitems: Array of EachItem objectscontrolled_anchor: Optional Node referenceitems_map: Map storing EachItem objects
The function ensures proper cleanup of effects while handling transitions and DOM updates.
- bounceIn
- Path: /packages/svelte/src/easing/index.js:75-77
- Summary: Here's a summary for the
bounceInfunction:
The bounceIn function is an easing function that creates a bouncing effect at the beginning of the animation. It takes a single parameter t (time or progress value between 0 and 1) and returns a transformed value. The function works by inverting the bounceOut effect, creating a bounce that starts strong and gradually settles.
Note: This function depends on a bounceOut function that should be defined elsewhere in the codebase.Total tokens used while classifying functions: 9140
I found 19 functions that handle animations and transitions in the Svelte codebase! Here's a breakdown of the key categories:
slide- Creates sliding animations with configurable axis, duration, and easingfade- Handles opacity transitions for fade-in/fade-out effectsscale- Combines scale and opacity animationsfly- Moves elements along x/y coordinates with opacity changesblur- Creates blur effects with opacity transitionsdraw- SVG stroke animations that reveal/hide paths progressively
flip- Implements FLIP (First, Last, Invert, Play) animation technique for position transitionscrossfade- Creates coordinated transitions between elements using matching keysanimate- Comprehensive animation handler supporting intro/outro transitions with keyframesanimation- Manages animations for keyed{#each}blocks during DOM reconciliation
tweened- Creates smooth value transitions over time (deprecated in favor of newer APIs)tick_spring- Physics-based spring animations with stiffness, damping, and masstick- Handles animation frame updates and timing
bounceIn,bounceInOut- Bounce easing effects for natural-feeling animations
pause_effect- Gracefully pauses effects during transitionsrun_out_transitions- Executes multiple "out" transitions and handles completionpause_effects- Coordinates pausing and cleanup of multiple effectsAnimateDirective- Handles animation directives in component compilation
These functions collectively provide Svelte's comprehensive animation and transition system, covering everything from simple CSS property animations to complex physics-based motion and coordinated element transitions.