VSTGUI 4.10
Graphical User Interface Framework not only for VST plugins
|
VSTGUI version 4 adds simple to use view animation support.
The source can be found under /lib/animation/
Every CFrame object can have one Animator object which runs animations at 60 Hz.
The animator is responsible for running animations. You can add and remove animations. Animations are identified by a view and a name.
To add an animation you just call CView::addAnimation (name, target, timing). The animation will start immediately and will automatically be removed if it has finished. If you want to stop it before it has finished you can use CView::removeAnimation (name). You can also stop all animations for a view with CView::removeAllAnimations ().
The animator is the owner of the target and timing function objects and will destroy these objects when the animation has finished. This means that the animator will call delete on these objects or if they are inherited from CBaseObject it will call forget() on them.
An animation is made up by an IAnimationTarget and an ITimingFunction object.
The animation target is responsible for changing the view from one state to another state.
The animation target interface consists of 3 methods:
All these methods have the view and the animation name as arguments to identify the animation within the target. The animationTick method in addition has the normalized animation position as argument and the animationFinished method has a bool argument indicating if the animation was canceled.
see included animation target classes
the animation timing function maps elapsed time to a normalized position.
see included animation timing function classes
In this example the custom view animates it's alpha value when the mouse moves inside or outside the view.