JUCE
Loading...
Searching...
No Matches
Public Member Functions | List of all members
StaticAnimationLimits< ValueType > Class Template Reference

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

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

Detailed Description

template<typename ValueType>
class 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);
};
Helper class for using linear interpolation between a begin and an end value.
Definition juce_StaticAnimationLimits.h:75
ValueType lerp(float value) const
Returns a value that is a linear interpolation of the beginning and end state.
Definition juce_StaticAnimationLimits.h:100
StaticAnimationLimits< ValueType > makeAnimationLimits(const ValueType &end)
Creates an instance of StaticAnimationLimits, deducing ValueType from the function argument.
Definition juce_StaticAnimationLimits.h:118
void int int h
Definition juce_UnityPluginInterface.h:199
void int w
Definition juce_UnityPluginInterface.h:199
float x
Definition juce_UnityPluginInterface.h:201
float float y
Definition juce_UnityPluginInterface.h:201
@ valueChanged
Indicates that the UI element's value has changed.
See also
ValueAnimatorBuilder::ValueChangedCallback

Constructor & Destructor Documentation

◆ StaticAnimationLimits() [1/2]

Constructor.

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

Referenced by SpeakerMappings::channelSetToVstArrangement(), SpeakerMappings::channelSetToVstArrangementType(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::convertSamples(), juce::dsp::SIMDRegister< Type >::copyToRawArray(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::get32BitResolution(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::getBytesPerSample(), SpeakerMappings::getMappings(), SpeakerMappings::getSpeakerType(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::isFloatingPoint(), juce::dsp::SIMDRegister< Type >::multiplyAdd(), juce::dsp::SIMDRegister< Type >::operator&(), juce::dsp::SIMDRegister< Type >::operator&(), juce::dsp::SIMDRegister< Type >::operator&=(), juce::dsp::SIMDRegister< Type >::operator&=(), juce::dsp::SIMDRegister< Type >::operator*(), juce::dsp::SIMDRegister< Type >::operator*(), juce::dsp::SIMDRegister< Type >::operator*=(), juce::dsp::SIMDRegister< Type >::operator*=(), juce::dsp::SIMDRegister< Type >::operator-(), juce::dsp::SIMDRegister< Type >::operator-(), juce::dsp::SIMDRegister< Type >::operator-=(), juce::dsp::SIMDRegister< Type >::operator-=(), SpeakerMappings::VstSpeakerConfigurationHolder::operator=(), juce::dsp::SIMDRegister< Type >::operator==(), juce::dsp::SIMDRegister< Type >::operator^(), juce::dsp::SIMDRegister< Type >::operator^(), juce::dsp::SIMDRegister< Type >::operator^=(), juce::dsp::SIMDRegister< Type >::operator^=(), juce::dsp::SIMDRegister< Type >::operator|(), juce::dsp::SIMDRegister< Type >::operator|(), juce::dsp::SIMDRegister< Type >::operator|=(), juce::dsp::SIMDRegister< Type >::operator|=(), juce::dsp::SIMDRegister< Type >::operator~(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::setAsFloat(), AudioData::Pointer< SampleFormat, Endianness, InterleavingType, Constness >::setAsInt32(), SpeakerMappings::vstArrangementTypeToChannelSet(), and SpeakerMappings::VstSpeakerConfigurationHolder::VstSpeakerConfigurationHolder().

◆ StaticAnimationLimits() [2/2]

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 Function Documentation

◆ operator()()

Evaluation operator.

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

◆ lerp()

template<typename ValueType >
ValueType StaticAnimationLimits< ValueType >::lerp ( float  value) const

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

References begin(), and end().


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