|
| | AnimatedScale (juce::Component &owner, const juce::String &property="scale", float initial=1.0f) |
| | ~AnimatedScale () override |
| void | setOrigin (juce::Point< float > relativeOrigin) |
| | Sets the pivot relative to the owner's bounds, (0.5, 0.5) its centre.
|
| juce::Point< float > | getOrigin () const |
| | Animated (juce::Component &owner, const juce::String &property={}, float initial=float()) |
| const float & | get () const |
| | Returns the current, possibly mid-transition, value.
|
| | operator const float & () const |
| | Returns the current value, so an Animated<T> can be passed where a T is expected.
|
| const float & | getTarget () const |
| | Returns the value the transition heads for, the current one when none runs.
|
| void | setValue (float newValue) |
| | Jumps to the value, stopping any transition.
|
| void | setTarget (float newTarget) |
| | Eases to the value with the owner's transition for the property.
|
| void | updateTarget (float newTarget) |
| | Changes the target of a running transition without restarting it: start value, start time and easing stay, so it still ends on time.
|
| void | followTarget (float newTarget) |
| | For a target that streams in, like live colours or a meter: starts a transition when none runs, otherwise moves the running one's target (updateTarget()).
|
| | AnimatedBase (juce::Component &owner, const juce::String &property) |
| virtual | ~AnimatedBase () |
| bool | isAnimating () const |
| | True while a transition runs.
|
| juce::Component * | getOwner () const |
| | The owning component, nullptr once it was deleted.
|
| const juce::String & | getProperty () const |
| | The name the layout's "transition" entries know this value by.
|
| Transition | getTransition () const |
| | The transition setTarget (value) uses: the owner's for the property, see Transition::forProperty.
|
An Animated<float> scale applied to its owner with juce::Component::setTransform, about an origin relative to the owner's bounds (its centre by default), so it zooms from the centre instead of towards the bottom right.
The pivot follows the owner when it moves or resizes, also during a "bounds" transition. A scale of 1 clears the transform.
It owns the owner's transform: a transform set elsewhere is replaced on the next change. A component that needs its own transform too should be scaled through a parent or child. Hit testing follows the transform; JUCE repaints the enlarged area. Decorations painted by an ancestor (shadows) can follow it through a juce::ComponentListener on the owner: setTransform sends componentMovedOrResized (c, false, false).
The layout's "scale" entry uses it as well (with "origin"); give a component a scale from the layout or from code, not both.
class Tile : public juce::Button
{
public:
void buttonStateChanged() override { zoom.setTarget (isOver() ? 1.03f : 1.0f); }
private:
gin::AnimatedScale zoom { *this };
};