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

## Detailed Description

Wrapper class for managing the lifetime of all the different animator kinds created through the builder classes.

It uses reference counting. If you copy an Animator the resulting object will refer to the same underlying instance, and the underlying instance is guaranteed to remain valid for as long as you have an Animator object referencing it.

An Animator object can be registered with the AnimatorUpdater, which only stores a weak reference to the underlying instance. If an AnimatorUpdater references the underlying instance and it becomes deleted due to all Animator objects being deleted, the updater will automatically remove it from its queue, so manually removing it is not required.

See also
  ValueAnimatorBuilder, AnimatorSetBuilder, AnimatorUpdater, VBlankAnimatorUpdater

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

- juce_animation/animation/juce_Animator.h

## Classes

struct | Compare
| Comparison function used by the implementation to store Animators in ordered collections. More...
class | Weak

## Public Types

enum class | Status { idle , inProgress , finished }
| The state of an Animator that determines how AnimatorUpdaters and other Animators will interact with it. More...

## Public Member Functions

| Animator (std::shared_ptr< Impl >)
double | getDurationMs () const
| Returns the total animation duration in milliseconds.
void | start () const
| Marks the Animator ready for starting.
void | complete () const
| Marks the Animator ready to be completed.
Status | update (double timestampMs) const
| Called periodically for active Animators by the AnimatorUpdater classes.
bool | isComplete () const
| Returns true if the Animator has reached the point of completion either because complete() has been called on it, or in case of the ValueAnimator, if it reached a progress of >= 1.0.
Weak | makeWeak () const

## Member Enums

## Status

enum class juce::Animator::Status

strong

The state of an Animator that determines how AnimatorUpdaters and other Animators will interact with it.

Enumerator
idle | The Animator is idle and its state is not progressing even if it is attached to an AnimatorUpdater.
inProgress | The Animator is active and its state is progressing whenever its update function is called.
finished | The Animator finished its run and its onCompletion callback may be called. It requires no further calls to its update function.

## Constructors and Destructors

## Animator()

juce::Animator::Animator | ( | std::shared_ptr< Impl > |  | ) |

explicit

Referenced by juce::Animator::Weak::lock(), and juce::Animator::Compare::operator()().

## Member Functions

## getDurationMs()

double juce::Animator::getDurationMs | ( |  | ) | const

Returns the total animation duration in milliseconds.

## start()

void juce::Animator::start | ( |  | ) | const

Marks the Animator ready for starting.

You must call this function to allow the Animator to move out of the idle state.

After calling this function the Animator's on start callback will be executed at the next update immediately followed by the first call to it's update function.

You can call this function before or after adding the Animator to an AnimatorUpdater. Until start() is called the Animator will just sit idly in the updater's queue.

## complete()

void juce::Animator::complete | ( |  | ) | const

Marks the Animator ready to be completed.

ValueAnimators will be completed automatically when they reach a progress >= 1.0 unless they are infinitely running. AnimatorSets will also complete on their own when all of their constituent Animators complete.

Using this function you can fast track the completion of an Animator. After calling this function isComplete will return true, and it's guaranteed that you will receive an update callback with a progress value of 1.0. After this the onComplete callback will be executed.

## update()

Status juce::Animator::update | ( | double | timestampMs | ) | const

Called periodically for active Animators by the AnimatorUpdater classes.

The passed in timestamp must be monotonically increasing. This allows the underlying Animator to follow its progression towards completion.

While you can call this function in special circumstances, you will generally want an AnimatorUpdater to do it. Using the VBlankAnimatorUpdater ensures that update is called in sync with the monitor's vertical refresh resulting in smooth animations.

See also
  AnimatorUpdater, VBlankAnimatorUpdater

## isComplete()

bool juce::Animator::isComplete | ( |  | ) | const

Returns true if the Animator has reached the point of completion either because complete() has been called on it, or in case of the ValueAnimator, if it reached a progress of >= 1.0.

You typically don't need to call this function, because in any case a completed Animator will receive an update callback with a progress value of 1.0 and following that the on complete callback will be called.

## makeWeak()

Weak juce::Animator::makeWeak | ( |  | ) | const

inline

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