Loading...
Searching...
No Matches
AnimatorSetBuilder Class Reference

A builder class that can be used to construct an Animator wrapping an AnimatorSet implementation. More...

#include <juce_AnimatorSetBuilder.h>

Public Member Functions

 AnimatorSetBuilder (Animator startingAnimator)
 Creates a new builder instance specifying the startingAnimator as the first Animator that is started.
 
 AnimatorSetBuilder (double delayMs)
 Creates a builder with an empty starting animation that completes after delayMs.
 
 AnimatorSetBuilder (std::function< void()> cb)
 Creates a builder with a starting animation that completes at the first update and executes the provided callback function.
 
AnimatorSetBuilder togetherWith (Animator animator)
 Adds an Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object.
 
AnimatorSetBuilder togetherWith (double delayMs)
 Adds an empty Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object, and completes in delayMs.
 
AnimatorSetBuilder togetherWith (std::function< void()> cb)
 Adds an empty Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object, completes upon its first update, and executes the provided callback.
 
AnimatorSetBuilder followedBy (Animator animator)
 Adds an Animator to the execution graph that will start executing after the Animator provided last to this builder object completes.
 
AnimatorSetBuilder followedBy (double delayMs)
 Adds an empty Animator to the execution graph that will start executing after the Animator provided last to this builder object.
 
AnimatorSetBuilder followedBy (std::function< void()> cb)
 Adds an empty Animator to the execution graph that will start executing after the Animator provided last to this builder object, completes upon its first update, and executes the provided callback.
 
AnimatorSetBuilder withTimeTransform (std::function< double(double)> transform)
 Specifies a time transformation function that the built Animator should utilise, allowing accelerating and decelerating the entire set of Animators.
 
Animator build ()
 Builds an Animator that executes the previously described and parameterised execution graph.
 

Detailed Description

A builder class that can be used to construct an Animator wrapping an AnimatorSet implementation.

It allows you to compose larger, complex animations by executing multiple constituent Animator instances in a coordinated manner. It essentially builds an Animator with an execution graph referencing other Animators.

Unlike ValueAnimatorBuilder, objects of AnimatorSetBuilder returned by its member functions reference the same underlying, modifiable builder instance. For this reason build() can be called only once on an underlying builder instance. This is to allow you to attach Animators to different points of the execution graph.

E.g. to have two functions followed by different amounts of delay, each followed by another function you would write the following.

// Both objects reference the same execution graph, but also refer to different Animators in it
auto builderReferencingFirst = AnimatorSetBuilder { firstFunction };
auto builderReferencingSecond = builderReferencingFirst.togetherWith (secondFunction);
builderReferencingFirst.followedBy (200).followedBy (thirdFunction);
builderReferencingSecond.followedBy (500).followedBy (fourthFunction);
// You could use any one of the builder objects that refer to the same execution graph
auto animator = builderReferencingFirst.build();
A builder class that can be used to construct an Animator wrapping an AnimatorSet implementation.
Definition juce_AnimatorSetBuilder.h:71
AnimatorSetBuilder togetherWith(Animator animator)
Adds an Animator to the execution graph that will start executing at the same time as the Animator pr...
Animator build()
Builds an Animator that executes the previously described and parameterised execution graph.
AnimatorSetBuilder followedBy(Animator animator)
Adds an Animator to the execution graph that will start executing after the Animator provided last to...

Constructor & Destructor Documentation

◆ AnimatorSetBuilder() [1/3]

AnimatorSetBuilder::AnimatorSetBuilder ( Animator startingAnimator)
explicit

Creates a new builder instance specifying the startingAnimator as the first Animator that is started.

◆ AnimatorSetBuilder() [2/3]

AnimatorSetBuilder::AnimatorSetBuilder ( double delayMs)
explicit

Creates a builder with an empty starting animation that completes after delayMs.

◆ AnimatorSetBuilder() [3/3]

AnimatorSetBuilder::AnimatorSetBuilder ( std::function< void()> cb)
explicit

Creates a builder with a starting animation that completes at the first update and executes the provided callback function.

Member Function Documentation

◆ togetherWith() [1/3]

AnimatorSetBuilder AnimatorSetBuilder::togetherWith ( Animator animator)

Adds an Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object.

◆ togetherWith() [2/3]

AnimatorSetBuilder AnimatorSetBuilder::togetherWith ( double delayMs)

Adds an empty Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object, and completes in delayMs.

◆ togetherWith() [3/3]

AnimatorSetBuilder AnimatorSetBuilder::togetherWith ( std::function< void()> cb)

Adds an empty Animator to the execution graph that will start executing at the same time as the Animator provided last to this builder object, completes upon its first update, and executes the provided callback.

◆ followedBy() [1/3]

AnimatorSetBuilder AnimatorSetBuilder::followedBy ( Animator animator)

Adds an Animator to the execution graph that will start executing after the Animator provided last to this builder object completes.

◆ followedBy() [2/3]

AnimatorSetBuilder AnimatorSetBuilder::followedBy ( double delayMs)

Adds an empty Animator to the execution graph that will start executing after the Animator provided last to this builder object.

◆ followedBy() [3/3]

AnimatorSetBuilder AnimatorSetBuilder::followedBy ( std::function< void()> cb)

Adds an empty Animator to the execution graph that will start executing after the Animator provided last to this builder object, completes upon its first update, and executes the provided callback.

◆ withTimeTransform()

AnimatorSetBuilder AnimatorSetBuilder::withTimeTransform ( std::function< double(double)> transform)

Specifies a time transformation function that the built Animator should utilise, allowing accelerating and decelerating the entire set of Animators.

The provided function should be monotonically increasing.

◆ build()

Animator AnimatorSetBuilder::build ( )

Builds an Animator that executes the previously described and parameterised execution graph.

This function should only be called once for every AnimatorSetBuilder created by its public constructor.


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram