Home / Function/ t() — svelte Function Reference

t() — svelte Function Reference

Architecture documentation for the t() function in animation-helpers.js from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  1178bca5_bbb4_558b_494c_889a96fd3acc["t()"]
  3ae2bea3_65e8_95e9_3e41_46d185d3488f["Animation"]
  1178bca5_bbb4_558b_494c_889a96fd3acc -->|defined in| 3ae2bea3_65e8_95e9_3e41_46d185d3488f
  53810586_8a4b_fcb0_de2b_1a8dcbf51d4a["interpolate()"]
  1178bca5_bbb4_558b_494c_889a96fd3acc -->|calls| 53810586_8a4b_fcb0_de2b_1a8dcbf51d4a
  style 1178bca5_bbb4_558b_494c_889a96fd3acc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/svelte/tests/animation-helpers.js lines 97–128

	#apply_keyframe(t) {
		const n = Math.min(1, Math.max(0, t)) * (this.#keyframes.length - 1);

		const lower = this.#keyframes[Math.floor(n)];
		const upper = this.#keyframes[Math.ceil(n)];

		let frame = lower;
		if (lower !== upper) {
			frame = {};

			for (const key in lower) {
				frame[key] = interpolate(
					/** @type {string} */ (lower[key]),
					/** @type {string} */ (upper[key]),
					n % 1
				);
			}
		}

		for (let prop in frame) {
			// @ts-ignore
			this.target.style[prop] = frame[prop];
		}

		if (this.currentTime >= this.#duration) {
			this.currentTime = this.#duration;
			for (let prop in frame) {
				// @ts-ignore
				this.target.style[prop] = null;
			}
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does t() do?
t() is a function in the svelte codebase, defined in packages/svelte/tests/animation-helpers.js.
Where is t() defined?
t() is defined in packages/svelte/tests/animation-helpers.js at line 97.
What does t() call?
t() calls 1 function(s): interpolate.

Analyze Your Own Codebase

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

Try Supermodel Free