mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Update spring docs
This commit is contained in:
parent
5f752fe903
commit
2518e292ed
2 changed files with 4 additions and 4 deletions
|
|
@ -11,11 +11,11 @@ Returns a new source with a value always moving torwards the input source value.
|
||||||
source: () -> T & Animatable,
|
source: () -> T & Animatable,
|
||||||
period: number = 1,
|
period: number = 1,
|
||||||
damping_ratio: number = 1
|
damping_ratio: number = 1
|
||||||
): (() -> T, Setter<T>)
|
): (() -> T, SpringConfig<T>)
|
||||||
|
|
||||||
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3 | Rect
|
type Animatable = number | CFrame | Color3 | UDim | UDim2 | Vector2 | Vector3 | Rect
|
||||||
|
|
||||||
type Setter<T> = ({
|
type SpringConfig<T> = ({
|
||||||
position: T?,
|
position: T?,
|
||||||
velocity: T?,
|
velocity: T?,
|
||||||
impulse: T?
|
impulse: T?
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ local function spring<T>(source: () -> T, period: number?, damping_ratio: number
|
||||||
-- set output to goal
|
-- set output to goal
|
||||||
output.cache = data.source_value
|
output.cache = data.source_value
|
||||||
|
|
||||||
local setter = function(p)
|
local config = function(p)
|
||||||
local x = p.position
|
local x = p.position
|
||||||
local v = p.velocity
|
local v = p.velocity
|
||||||
local dv = p.impulse
|
local dv = p.impulse
|
||||||
|
|
@ -229,7 +229,7 @@ local function spring<T>(source: () -> T, period: number?, damping_ratio: number
|
||||||
output.cache = v
|
output.cache = v
|
||||||
|
|
||||||
return v
|
return v
|
||||||
end, setter
|
end, config
|
||||||
end
|
end
|
||||||
|
|
||||||
local function step_springs(dt: number)
|
local function step_springs(dt: number)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue