animations #
Animations
a module to animate individual variables.
All Functions are taken from easings.net by Andrey Sitnik and Ivan Solovev
fn ease_in_back #
fn ease_in_back(x f64) f64
Back
fn ease_in_bounce #
fn ease_in_bounce(x f64) f64
Bounce
fn ease_in_circ #
fn ease_in_circ(x f64) f64
Circ
fn ease_in_cubic #
fn ease_in_cubic(x f64) f64
Cubic
fn ease_in_elastic #
fn ease_in_elastic(x f64) f64
Elastic
fn ease_in_expo #
fn ease_in_expo(x f64) f64
Expo
fn ease_in_out_back #
fn ease_in_out_back(x f64) f64
fn ease_in_out_bounce #
fn ease_in_out_bounce(y f64) f64
fn ease_in_out_circ #
fn ease_in_out_circ(x f64) f64
fn ease_in_out_cubic #
fn ease_in_out_cubic(x f64) f64
fn ease_in_out_elastic #
fn ease_in_out_elastic(x f64) f64
fn ease_in_out_expo #
fn ease_in_out_expo(x f64) f64
fn ease_in_out_quad #
fn ease_in_out_quad(x f64) f64
fn ease_in_out_quart #
fn ease_in_out_quart(x f64) f64
fn ease_in_out_quint #
fn ease_in_out_quint(x f64) f64
fn ease_in_out_sine #
fn ease_in_out_sine(x f64) f64
fn ease_in_quad #
fn ease_in_quad(x f64) f64
Quad
fn ease_in_quart #
fn ease_in_quart(x f64) f64
Quart
fn ease_in_quint #
fn ease_in_quint(x f64) f64
Quint
fn ease_in_sine #
fn ease_in_sine(x f64) f64
Sine
fn ease_out_back #
fn ease_out_back(x f64) f64
fn ease_out_bounce #
fn ease_out_bounce(y f64) f64
TODO: Fix Ease Out Bounce doing funky things
fn ease_out_circ #
fn ease_out_circ(x f64) f64
fn ease_out_cubic #
fn ease_out_cubic(x f64) f64
fn ease_out_elastic #
fn ease_out_elastic(x f64) f64
fn ease_out_expo #
fn ease_out_expo(x f64) f64
fn ease_out_quad #
fn ease_out_quad(x f64) f64
fn ease_out_quart #
fn ease_out_quart(x f64) f64
fn ease_out_quint #
fn ease_out_quint(x f64) f64
fn ease_out_sine #
fn ease_out_sine(x f64) f64
fn linear #
fn linear(x f64) f64
Linear
fn new_animation_manager #
fn new_animation_manager(clean_finished_tasks bool) &AnimationManager
new_animation_manager
create a new Animation Manager.
clean_finished_tasks bool - Determine if the AnimationTasks should be cleared once they complete.
struct AnimationManager #
struct AnimationManager {
mut:
tasks map[u64]AnimationTask
clean bool = true
stopwatch time.StopWatch
pub mut:
millisecond_counter u64
}
The Animation manager, holding all the AnimationTasks.
Don't directly create one but instead use new_animation_manager.
fn (AnimationManager) set_clean #
fn (mut manager AnimationManager) set_clean(clean bool)
set_clean set if the manager should remove finished tasks.
fn (AnimationManager) add #
fn (mut manager AnimationManager) add(mut v &f32, f f32, t f32, d i64, m fn (f64) f64, loop bool) u64
add
Add a new task to the AnimationManager.
v - a pointer to the value to animate.
f - the value to start from.
t - the value to animate to.
d - the duration to take in milliseconds.
m - the method to use. See the easing animations in this module.
loop - should the animation be looped between from and to value
Returns the id of the created task.
fn (AnimationManager) cancel #
fn (mut manager AnimationManager) cancel(task_id u64) bool
cancel
Cancels a task. This will not finish the task. It will just cancel it mid-time.
task_id - the id of the task
Returns true if deleted successfully. False otherwise
fn (AnimationManager) loop #
fn (mut manager AnimationManager) loop()
loop
The loop of the AnimationManager.
run in a separated thread using go manager.loop()