JUCE v8.0.9
JUCE API
 
Loading...
Searching...
No Matches
juce::AnimatorSetBuilder Class Reference

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

#include <juce_AnimatorSetBuilder.h>

Collaboration diagram for juce::AnimatorSetBuilder:

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.
 
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 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 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 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.
 

Private Member Functions

 AnimatorSetBuilder (Animator cursorIn, std::shared_ptr< AnimatorSetBuilderState > dataIn)
 
 AnimatorSetBuilder (std::shared_ptr< AnimatorSetBuilderState > dataIn)
 
void add (std::optional< Animator > parent, Animator child)
 

Private Attributes

Animator cursor
 
std::shared_ptr< AnimatorSetBuilderState > state
 

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:68
AnimatorSetBuilder togetherWith(Animator animator)
Adds an Animator to the execution graph that will start executing at the same time as the Animator pr...
AnimatorSetBuilder followedBy(Animator animator)
Adds an Animator to the execution graph that will start executing after the Animator provided last to...
Animator build()
Builds an Animator that executes the previously described and parameterised execution graph.

@tags{Animations}

Constructor & Destructor Documentation

◆ AnimatorSetBuilder() [1/5]

juce::AnimatorSetBuilder::AnimatorSetBuilder ( Animator  startingAnimator)
explicit

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

◆ AnimatorSetBuilder() [2/5]

juce::AnimatorSetBuilder::AnimatorSetBuilder ( double  delayMs)
explicit

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

◆ AnimatorSetBuilder() [3/5]

juce::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.

◆ AnimatorSetBuilder() [4/5]

juce::AnimatorSetBuilder::AnimatorSetBuilder ( std::shared_ptr< AnimatorSetBuilderState >  dataIn)
explicitprivate

◆ AnimatorSetBuilder() [5/5]

juce::AnimatorSetBuilder::AnimatorSetBuilder ( Animator  cursorIn,
std::shared_ptr< AnimatorSetBuilderState >  dataIn 
)
private

Member Function Documentation

◆ add()

void juce::AnimatorSetBuilder::add ( std::optional< Animator parent,
Animator  child 
)
private

◆ build()

Animator juce::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.

◆ followedBy() [1/3]

AnimatorSetBuilder juce::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 juce::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 juce::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.

◆ togetherWith() [1/3]

AnimatorSetBuilder juce::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 juce::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 juce::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.

◆ withTimeTransform()

AnimatorSetBuilder juce::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.

Member Data Documentation

◆ cursor

Animator juce::AnimatorSetBuilder::cursor
private

◆ state

std::shared_ptr<AnimatorSetBuilderState> juce::AnimatorSetBuilder::state
private

The documentation for this class was generated from the following file: