/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ import type { ReactiveController, ReactiveControllerHost } from 'lit'; import { Spring, SpringConfig as WobbleSpringConfig } from 'wobble'; export type SpringConfig = Partial; /** * A reactive controller that implements a 1D spring physics simulation based * on the equations behind damped harmonic oscillators * (https://en.wikipedia.org/wiki/Harmonic_oscillator#Damped_harmonic_oscillator). */ export declare class SpringController implements ReactiveController { private _host; protected _spring: Spring; private _toValue; private _fromValue; constructor(host: ReactiveControllerHost & HTMLElement, options?: SpringConfig); get currentValue(): number; /** * The spring's current velocity in units / ms. */ get currentVelocity(): number; /** * If the spring has reached its `toValue`, or if its velocity is below the * `restVelocityThreshold`, it is considered at rest. If `stop()` is called * during a simulation, both `isAnimating` and `isAtRest` will be false. */ get isAtRest(): boolean; /** * Whether or not the spring is currently emitting values. * * Note: this is distinct from whether or not it is at rest. * See also `isAtRest`. */ get isAnimating(): boolean; get fromValue(): number; set fromValue(fromValue: number); get toValue(): number; set toValue(toValue: number); hostConnected(): void; hostDisconnected(): void; } export interface Position2D { x: number; y: number; } export interface Spring2DConfig extends Omit { toPosition?: Position2D; fromPosition?: Position2D; initialVelocity?: Position2D; } /** * A reactive controller that implements a 2D spring physics simulation. * * The 2D spring is modeled with two 1D springs, one for each axis. */ export declare class SpringController2D implements ReactiveController { private _springX; private _springY; constructor(host: ReactiveControllerHost & HTMLElement, options?: Spring2DConfig); get currentPosition(): Position2D; /** * The spring's current velocity in units / ms. */ get currentVelocity(): Position2D; /** * If the spring has reached its `toValue`, or if its velocity is below the * `restVelocityThreshold`, it is considered at rest. If `stop()` is called * during a simulation, both `isAnimating` and `isAtRest` will be false. */ get isAtRest(): boolean; /** * Whether or not the spring is currently emitting values. * * Note: this is distinct from whether or not it is at rest. * See also {@link isAtRest}. */ get isAnimating(): boolean; get toPosition(): Position2D; set toPosition(v: Position2D); hostConnected(): void; hostDisconnected(): void; } //# sourceMappingURL=spring.d.ts.map