defineAnimationEffect static method
void
defineAnimationEffect()
Defines a new named effect to be used in animation, along with a function that tells the AnimationManager how to modify that property.
Effect names do not need to reflect GraphObject properties, and you can define an effect with a function that modifies several properties for convenience.
For example, one could define an animation effect named "moveAndSpin"
which modifies the object's position
and angle
.
Most commonly, an effect is defined with one GraphObject property in mind to be animated, and the function uses the start and end values, an easing function, and the times to determine a new value for each tick of animation. Here is an example for animating the fill of GraphObjects:
// This presumes the object to be animated is a Shape
go.AnimationManager.defineAnimationEffect('fill', (obj, startValue, endValue, easing, currentTime, duration, animation) => {
var hueValue = easing(currentTime, startValue, endValue - startValue, duration);
obj.fill = 'hsl(' + hueValue + ', 100%, 80%)';
});
Implementation
static void defineAnimationEffect(
_i2.String effectName,
void Function(
_i2.Object,
_i3.EasingFunction,
_i2.num,
_i2.num,
_i3.Animation, [
_i2.dynamic,
_i2.dynamic,
]) animationFunction,
) {
_i4.callMethod(
_declaredAnimationManager,
'defineAnimationEffect',
[
effectName,
_i4.allowInterop(animationFunction),
],
);
}