Empirical
Classes | Namespaces
Tween.h File Reference

A Tween manages the gradual shift in properties of one or more widgets over time. More...

#include "emfunctions.h"
#include "Widget.h"

Go to the source code of this file.

Classes

class  emp::web::Tween
 

Namespaces

 emp
 If we are in emscripten, make sure to include the header.
 
 emp::web
 

Detailed Description

A Tween manages the gradual shift in properties of one or more widgets over time.

Note
This file is part of Empirical, https://github.com/devosoft/Empirical
Date
2015-2017

To create a Tween, a duration must be specified, along with an optional default target. Once a Tween is setup, paths can be added to it, which represent the changes that should occur over the specified duration.

A path can be a function to call (with the 0.0 to 1.0 fraction of the time that's gone by) or a variable to set to the current fraction. Dependants can also be set to refresh with each Tween update.

Available methods include: Tween & AddPath(std::function<void(double)> set_fun, double start_val, double end_val, std::function<double(double)> timing=LINEAR); Tween & AddPath(double & set_var, double start_val, double end_val, std::function<double(double)> timing=LINEAR); Tween & AddDependant(Widget w); void Start(); void Stop();

Todo:

Need to setup an AddPath that actually uses widgets and properties (stub in place).

Need a Reverse(), which swaps start and end positions.

Need a Reset()