// Animate these elements' style and/or position to explicit targets over duration ms, easing the normalized time
eles.animate(opts: AnimateOptions): thisAnimate these elements' style and/or position to explicit targets over duration ms, easing the normalized time.
There is no queue: the animation starts immediately, animations on disjoint channels run concurrently, and starting one that overlaps a running animation's channels stops the older one in place — its promise resolves, its values freeze, and the new animation captures from there. Sequence with await animation( …).play() rather than by queueing.
Animatable: position; opacity (both groups); node background-color/border-color/border-width, edge line-color; and the geometry numerics node width/height, edge width, compound padding and font-size. Colours interpolate in OKLab, matching the colour mappers.
Use named easings or cubic-bezier( …), CSS linear( …) and spring( bounce). A custom easing function is rejected — a closure cannot cross to the GPU, so accepting one would mean a curve that silently depended on whether the animation got offloaded.
| Name | Description |
|---|---|
opts: AnimateOptions | targets ( |
Fields of opts
| Name | Description |
|---|---|
style: Record<string, string | number>? | |
position: Partial<Position>? | |
collapsed: boolean? | Target the collapsed state of compound parents. This is an element-only animation channel and may be combined with timing options, but not with other style, position, or viewport targets. |
pan: Position? | viewport targets (core.animate) |
panBy: Position? | viewport target: pan by a delta rather than to an absolute position.
Resolved against the pan at creation time, so a manual
pan afterwards does not move the target. Throws alongside |
zoom: number? | |
fit: { eles?: unknown; boundingBox?: { x1: number; y1: number; x2?: number; y2?: number; w?: number; h?: number; }; padding?: number; }? | viewport target: animate to the viewport that fits the given elements (or an explicit model-space box). Resolved to pan/zoom when the animation is created. |
center: { eles?: unknown }? | viewport target: animate the pan that centers the given elements |
duration: number? | |
easing: string? | A named easing, |
delay: number? | |
complete: () => void? |
thisthis collection, for chaining; use animation() when you want the handle
Example
eles.animate({ position: { x: 20, y: 10 }, duration: 100 });eles.stop(true);console.log(cy.getElementById('a').position('x')); // 20Collection#animation for the handle form with promise/pause/resume/reverse