mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Tween migrated (final)
Forgot to update a few stuff in my precedent commit. Everything is good now.
This commit is contained in:
parent
49744ea1c8
commit
92061e8368
3 changed files with 18 additions and 7 deletions
|
|
@ -18,8 +18,7 @@ local show = require "./show"
|
|||
local indexes = require "./indexes"
|
||||
local values = require "./values"
|
||||
local spring, update_springs = require "./spring"()
|
||||
-- Initialize the tween module
|
||||
local tween, update_tweens = require "./tween"()
|
||||
local tween, update_tweens = require "./tween"()
|
||||
local action = require "./action"()
|
||||
local changed = require "./changed"
|
||||
local timeout, update_timeouts = require "./timeout"()
|
||||
|
|
@ -78,7 +77,7 @@ local vide = {
|
|||
|
||||
-- animations
|
||||
spring = spring,
|
||||
tween = tween, -- Exposing tween to the user
|
||||
tween = tween,
|
||||
|
||||
-- actions
|
||||
action = action,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,21 @@
|
|||
local easings = require "./easings"
|
||||
|
||||
export type EasingStyle =
|
||||
"lerp"
|
||||
| "sine_ease_in" | "sine_ease_out" | "sine_ease_inout"
|
||||
| "quad_ease_in" | "quad_ease_out" | "quad_ease_inout"
|
||||
| "cubic_ease_in" | "cubic_ease_out" | "cubic_ease_inout"
|
||||
| "quart_ease_in" | "quart_ease_out" | "quart_ease_inout"
|
||||
| "quint_ease_in" | "quint_ease_out" | "quint_ease_inout"
|
||||
| "expo_ease_in" | "expo_ease_out" | "expo_ease_inout"
|
||||
| "circ_ease_in" | "circ_ease_out" | "circ_ease_inout"
|
||||
| "back_ease_in" | "back_ease_out" | "back_ease_inout"
|
||||
| "elastic_ease_in" | "elastic_ease_out" | "elastic_ease_inout"
|
||||
| "bounce_ease_in" | "bounce_ease_out" | "bounce_ease_inout"
|
||||
|
||||
export type TweenConfig = {
|
||||
time: number?,
|
||||
style: easings.EasingFunction?,
|
||||
style: EasingStyle?,
|
||||
delay: number?,
|
||||
reverses: boolean?,
|
||||
repeat_count: number?,
|
||||
|
|
@ -133,7 +146,7 @@ local function tween<T>(source: () -> T, config: TweenConfig?): () -> T
|
|||
|
||||
local data: TweenState<T> = {
|
||||
time = (config and config.time) or 1,
|
||||
style = (config and config.style) or easings.quad_ease_out,
|
||||
style = easings[(config and config.style) or "quad_ease_out"],
|
||||
delay = (config and config.delay) or 0,
|
||||
reverses = (config and config.reverses) or false,
|
||||
repeat_count = (config and config.repeat_count) or 0,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
local vide = require "../../vide"
|
||||
local easings = require "../src/easings"
|
||||
|
||||
local function system(): (number) -> number
|
||||
local MAX = 40
|
||||
|
|
@ -7,7 +6,7 @@ local function system(): (number) -> number
|
|||
|
||||
local _, input, output = vide.root(function()
|
||||
local input = vide.source(MAX)
|
||||
local output = vide.tween(input, { time = 2, style = easings.quad_ease_inout })
|
||||
local output = vide.tween(input, { time = 2, style = "quad_ease_inout" })
|
||||
return input, output
|
||||
end)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue