Loading...
Searching...
No Matches
juce::AnimatorUpdater Class Reference

## Detailed Description

Helper class to update several animators at once, without owning or otherwise extending the lifetimes of those animators.

The intended use case is to register Animators with an updater as opposed to separately calling Animator::update() on each of them. Calling update() then will update all registered Animators. In case an Animator's underlying implementation is deleted (all Animator objects that were strongly referencing it were deleted) it is automatically removed by the AnimatorUpdater.

If you want to update all your Animators in sync with the display refresh you will probably want to use the VBlankAnimatorUpdater.

The order in which Animator::update() functions are called for registered Animators is not specified, as Animators should be implemented in a way where it doesn't matter.

See also
  VBlankAnimatorUpdater

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

- juce_animation/animation/juce_AnimatorUpdater.h

Inheritance diagram for juce::AnimatorUpdater:

## Public Member Functions

void | addAnimator (const Animator &animator)
| Registers an Animator with the updater.
void | addAnimator (const Animator &animator, std::function< void()> onComplete)
| Registers an Animator with the updater and specifies a callback to be called upon the completion of the Animator.
void | removeAnimator (const Animator &animator)
| Removes an Animator.
void | update ()
| Calls Animator::update() for all registered Animators that are still alive.
void | update (double timestampMs)
| Calls Animator::update() for all registered Animators that are still alive.

## Member Functions

## addAnimator() [1/2]

void juce::AnimatorUpdater::addAnimator | ( | const Animator & | animator | ) |

Registers an Animator with the updater.

## addAnimator() [2/2]

void juce::AnimatorUpdater::addAnimator | ( | const Animator & | animator,
|  | std::function< void()> | onComplete )

Registers an Animator with the updater and specifies a callback to be called upon the completion of the Animator.

This callback can be used for cleanup purposes e.g.

animatorUpdater.addAnimator (someComponentPtr->getAnimator(),
[&someComponentPtr] { someComponentPtr.reset(); });

## removeAnimator()

void juce::AnimatorUpdater::removeAnimator | ( | const Animator & | animator | ) |

Removes an Animator.

## update() [1/2]

void juce::AnimatorUpdater::update | ( |  | ) |

Calls Animator::update() for all registered Animators that are still alive.

References to deleted Animators are removed.

Uses Time::getMillisecondCounterHiRes() to calculate the necessary timestamp. Consider using a VBlankAnimatorUpdater instead for using timestamps that are synchronised across all VBlankAnimatorUpdater instances.

Referenced by juce::VBlankAnimatorUpdater::VBlankAnimatorUpdater().

## update() [2/2]

void juce::AnimatorUpdater::update | ( | double | timestampMs | ) |

Calls Animator::update() for all registered Animators that are still alive.

References to deleted Animators are removed.

The supplied timestamp should be monotonically increasing for correct behaviour. Ideally this should be a timestamp supplied by a VBlankAttachment. Consider using the VBlankAnimatorUpdater class, which takes care of supplying the right timestamp.

See also
  VBlankAnimatorUpdater

References JUCE_API.

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited