Home / File/ animation-helpers.js — svelte Source File

animation-helpers.js — svelte Source File

Architecture documentation for animation-helpers.js, a javascript file in the svelte codebase. 4 imports, 2 dependents.

File javascript BuildSystem QualityControl 4 imports 2 dependents 5 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c["animation-helpers.js"]
  8e9a8b22_9754_09a3_8bf1_af0aeb68deca["task.js"]
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c --> 8e9a8b22_9754_09a3_8bf1_af0aeb68deca
  2cab0f64_6d19_d981_66e2_d2555c252702["queue_micro_task"]
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c --> 2cab0f64_6d19_d981_66e2_d2555c252702
  4ead6623_c53e_ab40_5690_64903d5addf1["svelte"]
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c --> 4ead6623_c53e_ab40_5690_64903d5addf1
  1a59b12b_63d5_2eb4_1881_6fb96dbdcb56["client"]
  e34c4197_0d2d_5f9c_9313_0d10c3cf054c --> 1a59b12b_63d5_2eb4_1881_6fb96dbdcb56
  1d0b62ee_f20d_508f_987f_2618ed1176d0["test.ts"]
  1d0b62ee_f20d_508f_987f_2618ed1176d0 --> e34c4197_0d2d_5f9c_9313_0d10c3cf054c
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831["shared.ts"]
  2cf8977f_8bb9_9ef1_6e90_d6eea1dac831 --> e34c4197_0d2d_5f9c_9313_0d10c3cf054c
  style e34c4197_0d2d_5f9c_9313_0d10c3cf054c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { flushSync } from 'svelte';
import { raf as svelte_raf } from 'svelte/internal/client';
import { queue_micro_task } from '../src/internal/client/dom/task.js';

export const raf = {
	/** @type {Set<Animation>} */
	animations: new Set(),
	/** @type {Set<(n: number) => void>} */
	ticks: new Set(),
	tick,
	time: 0,
	reset() {
		this.time = 0;
		this.animations.clear();
		this.ticks.clear();

		svelte_raf.tick = (f) => {
			raf.ticks.add(f);
		};
		svelte_raf.now = () => raf.time;
		svelte_raf.tasks.clear();
	}
};

/**
 * @param {number} time
 */
function tick(time) {
	raf.time = time;
	flushSync();
	for (const animation of raf.animations) {
		animation._update();
	}
	for (const tick of raf.ticks) {
		tick(raf.time);
	}
}

class Animation {
	#keyframes;
	#duration;
	#delay;

	#offset = raf.time;

	/** @type {Function} */
	#onfinish = () => {};

	/** @type {Function} */
	#oncancel = () => {};

	target;
	currentTime = 0;
	startTime = 0;
	playState = 'running';

	/**
	 * @param {HTMLElement} target
	 * @param {Keyframe[] | PropertyIndexedKeyframes | null} keyframes
	 * @param {number | KeyframeAnimationOptions | undefined} options
// ... (156 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does animation-helpers.js do?
animation-helpers.js is a source file in the svelte codebase, written in javascript. It belongs to the BuildSystem domain, QualityControl subdomain.
What functions are defined in animation-helpers.js?
animation-helpers.js defines 5 function(s): animate, getAnimations, interpolate, raf.reset, tick.
What does animation-helpers.js depend on?
animation-helpers.js imports 4 module(s): client, queue_micro_task, svelte, task.js.
What files import animation-helpers.js?
animation-helpers.js is imported by 2 file(s): shared.ts, test.ts.
Where is animation-helpers.js in the architecture?
animation-helpers.js is located at packages/svelte/tests/animation-helpers.js (domain: BuildSystem, subdomain: QualityControl, directory: packages/svelte/tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free