Loading...
Searching...
No Matches
juce::StaticAnimationLimits< ValueType > Class Template Reference

## Detailed Description

template<typename ValueType>
class juce::StaticAnimationLimits< ValueType >

Helper class for using linear interpolation between a begin and an end value.

The ValueType could be any numerical type, or a std::tuple containing numerical types. This class is mainly intended to be used with the latter.

This way you can interpolate multiple values by supplying a single float value, which you can access in an Animator's value change callback.

E.g.

const auto boundsToTuple = [] (auto b)
{
return std::make_tuple (b.getX(), b.getY(), b.getWidth(), b.getHeight());
};
const auto begin = boundsToTuple (component.getBoundsInParent());
const auto end = boundsToTuple (targetBounds);
const auto limits = makeAnimationLimits (begin, end);
// This is the value change callback of an Animator, where you will transition a Component from
// one bounds to the next. See the AnimatorsDemo for a more detailed example.
const auto valueChanged = [&component, limits] (auto v)
{
const auto [x, y, w, h] = limits.lerp (v);
component.setBounds (x, y, w, h);
};
h
void int int h
Definition juce_UnityPluginInterface.h:195
w
void int w
Definition juce_UnityPluginInterface.h:195
x
float x
Definition juce_UnityPluginInterface.h:197
y
float float y
Definition juce_UnityPluginInterface.h:197
juce::end
RangedDirectoryIterator end(const RangedDirectoryIterator &)
Returns a default-constructed sentinel value.
Definition juce_RangedDirectoryIterator.h:195
juce::makeAnimationLimits
StaticAnimationLimits< ValueType > makeAnimationLimits(const ValueType &end)
Creates an instance of StaticAnimationLimits, deducing ValueType from the function argument.
Definition juce_StaticAnimationLimits.h:117
juce::AccessibilityEvent::valueChanged
@ valueChanged
Indicates that the UI element's value has changed.
Definition juce_AccessibilityEvent.h:53
juce::begin
RangedDirectoryIterator begin(const RangedDirectoryIterator &it)
Returns the iterator that was passed in.
Definition juce_RangedDirectoryIterator.h:190

See also
  ValueAnimatorBuilder::ValueChangedCallback

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

- juce_animation/animation/juce_StaticAnimationLimits.h

## Public Member Functions

| StaticAnimationLimits (const ValueType &endIn)
| Constructor.
| StaticAnimationLimits (const ValueType &beginIn, const ValueType &endIn)
| Constructor.
ValueType | operator() (float value) const
| Evaluation operator.
ValueType | lerp (float value) const
| Returns a value that is a linear interpolation of the beginning and end state.

## Constructors and Destructors

## StaticAnimationLimits() [1/2]

template<typename ValueType>

juce::StaticAnimationLimits< ValueType >::StaticAnimationLimits | ( | const ValueType & | endIn | ) |

inline explicit

Constructor.

You can use it to interpolate between a 0 initialised numerical value or tuple and the provided end state.

References StaticAnimationLimits().

Referenced by StaticAnimationLimits().

## StaticAnimationLimits() [2/2]

template<typename ValueType>

juce::StaticAnimationLimits< ValueType >::StaticAnimationLimits | ( | const ValueType & | beginIn,
|  | const ValueType & | endIn )

inline

Constructor.

Creates an object that will interpolate between the two provided beginning and end states. The ValueType can be a numerical type or a std::tuple containing numerical types.

## Member Functions

## operator()()

template<typename ValueType>

ValueType juce::StaticAnimationLimits< ValueType >::operator() | ( | float | value | ) | const

inline

Evaluation operator.

Returns a value that is a linear interpolation of the beginning and end state. It's a shorthand for the lerp() function.

References lerp().

## lerp()

template<typename ValueType>

ValueType juce::StaticAnimationLimits< ValueType >::lerp | ( | float | value | ) | const

inline

Returns a value that is a linear interpolation of the beginning and end state.

Referenced by operator()().

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