Gin
Loading...
Searching...
No Matches
AnimatedProperties Class Reference

The animated values of one component that the layout and its States share, so a base value (the layout's "alpha" and "scale" entries) and a state's value (e.g. More...

#include <gin_states.h>

Inherits juce::ReferenceCountedObject.

Public Member Functions

 ~AnimatedProperties () override
void setBaseAlpha (float alpha, bool animate)
 The base values; animate false applies at once (a component's first layout).
void setBaseScale (float scale, juce::Point< float > origin, bool animate)
void setStateValues (const juce::var &values)
 The active states' values merged into one object ("alpha", "scale", "imageFilter"), void when no state is active.
const juce::var & getStateValues () const
void addImageFilter (AnimatedImageFilter &f)
void removeImageFilter (AnimatedImageFilter &f)
void setBaseShadow (const ShadowList &shadow, bool animate)
 The box shadow's base value and outline radius (see BoxShadow).
void setShadowRadius (float radius)
const ShadowList & getShadow () const
 The shadow as it shows now, mid-transition included.
float getShadowRadius () const

Static Public Member Functions

static AnimatedProperties & get (juce::Component &c)
 The component's, created when it has none.
static AnimatedProperties * find (const juce::Component &c)
 The component's, nullptr when it has none.

Public Attributes

std::function< void(juce::Component &)> onStep
 Called with the component on every step of its alpha or scale.

Detailed Description

The animated values of one component that the layout and its States share, so a base value (the layout's "alpha" and "scale" entries) and a state's value (e.g.

a hover scale) drive the same animation instead of fighting over it. A state's value wins while the state is active; leaving it eases back to the base value. Values:

  • "alpha" (Component::setAlpha, 0 hides, see LayoutSupport), base 1 without an entry
  • "scale" (an AnimatedScale about the "origin"), base 1 without an entry
  • "imageFilter" (a spec, see ImageFilter): sets the filter of every AnimatedImageFilter the component owns and eases their amount to 1, to 0 when no state sets one
  • "boxShadow" (see BoxShadow), base none without an entry

Timings come from Transition::forProperty for "alpha", "scale" and the filters' own property names ("imageFilter" by default). Kept in the component's properties, it lives as long as the component. Created on demand; LayoutSupport, States and AnimatedImageFilter use it, code rarely needs to.

Constructor & Destructor Documentation

◆ ~AnimatedProperties()

AnimatedProperties::~AnimatedProperties ( )
override

Member Function Documentation

◆ get()

AnimatedProperties & AnimatedProperties::get ( juce::Component & c)
static

The component's, created when it has none.

◆ find()

AnimatedProperties * AnimatedProperties::find ( const juce::Component & c)
static

The component's, nullptr when it has none.

◆ setBaseAlpha()

void AnimatedProperties::setBaseAlpha ( float alpha,
bool animate )

The base values; animate false applies at once (a component's first layout).

◆ setBaseScale()

void AnimatedProperties::setBaseScale ( float scale,
juce::Point< float > origin,
bool animate )

◆ setStateValues()

void AnimatedProperties::setStateValues ( const juce::var & values)

The active states' values merged into one object ("alpha", "scale", "imageFilter"), void when no state is active.

◆ getStateValues()

const juce::var & AnimatedProperties::getStateValues ( ) const

◆ addImageFilter()

void AnimatedProperties::addImageFilter ( AnimatedImageFilter & f)

◆ removeImageFilter()

void AnimatedProperties::removeImageFilter ( AnimatedImageFilter & f)

◆ setBaseShadow()

void AnimatedProperties::setBaseShadow ( const ShadowList & shadow,
bool animate )

The box shadow's base value and outline radius (see BoxShadow).

◆ setShadowRadius()

void AnimatedProperties::setShadowRadius ( float radius)

◆ getShadow()

const ShadowList & AnimatedProperties::getShadow ( ) const

The shadow as it shows now, mid-transition included.

◆ getShadowRadius()

float AnimatedProperties::getShadowRadius ( ) const

Member Data Documentation

◆ onStep

std::function<void (juce::Component&)> AnimatedProperties::onStep

Called with the component on every step of its alpha or scale.


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