Home / Class/ Tween Class — svelte Architecture

Tween Class — svelte Architecture

Architecture documentation for the Tween class in index.d.ts from the svelte codebase.

Entity Profile

Dependency Diagram

graph TD
  d508594d_4196_26a0_d4e0_f917e2df8c39["Tween"]
  6bd9d090_a582_e05c_669e_d53d4e7245f2["index.d.ts"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|defined in| 6bd9d090_a582_e05c_669e_d53d4e7245f2
  8e81d520_702d_8428_01c1_51b8073e1439["of()"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|method| 8e81d520_702d_8428_01c1_51b8073e1439
  d66be127_119e_a4e8_7b7f_ebf17cf63f0d["constructor()"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|method| d66be127_119e_a4e8_7b7f_ebf17cf63f0d
  225dcef9_88d5_e962_fb2d_b3d3f5401740["set()"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|method| 225dcef9_88d5_e962_fb2d_b3d3f5401740
  fb22a39c_45a6_7d15_e349_98409632ac35["current()"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|method| fb22a39c_45a6_7d15_e349_98409632ac35
  84bcc5ad_08d6_0453_438c_0e9a6b212a41["target()"]
  d508594d_4196_26a0_d4e0_f917e2df8c39 -->|method| 84bcc5ad_08d6_0453_438c_0e9a6b212a41

Relationship Graph

Source Code

packages/svelte/types/index.d.ts lines 2172–2201

	export class Tween<T> {
		/**
		 * Create a tween whose value is bound to the return value of `fn`. This must be called
		 * inside an effect root (for example, during component initialisation).
		 *
		 * ```svelte
		 * <script>
		 * 	import { Tween } from 'svelte/motion';
		 *
		 * 	let { number } = $props();
		 *
		 * 	const tween = Tween.of(() => number);
		 * </script>
		 * ```
		 * 
		 */
		static of<U>(fn: () => U, options?: TweenedOptions<U> | undefined): Tween<U>;
		
		constructor(value: T, options?: TweenedOptions<T>);
		/**
		 * Sets `tween.target` to `value` and returns a `Promise` that resolves if and when `tween.current` catches up to it.
		 *
		 * If `options` are provided, they will override the tween's defaults.
		 * */
		set(value: T, options?: TweenedOptions<T> | undefined): Promise<void>;
		get current(): T;
		set target(v: T);
		get target(): T;
		#private;
	}

Frequently Asked Questions

What is the Tween class?
Tween is a class in the svelte codebase, defined in packages/svelte/types/index.d.ts.
Where is Tween defined?
Tween is defined in packages/svelte/types/index.d.ts at line 2172.

Analyze Your Own Codebase

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

Try Supermodel Free