Loading...
Searching...
No Matches
Easings Struct Reference

Holds a number of easing functions that you can pass into ValueAnimatorBuilder::withEasing to transform the linear progression of animations. More...

#include <juce_Easings.h>

Static Public Member Functions

static std::function< float(float)> createCubicBezier (float x1, float y1, float x2, float y2)
 Returns a cubic Bezier function with the control points (x1, y1), (x2, y2).
 
static std::function< float(float)> createCubicBezier (Point< float > controlPoint1, Point< float > controlPoint2)
 Returns a cubic Bezier function with two control points.
 
static std::function< float(float)> createEase ()
 Returns the easing function createCubicBezier (0.25f, 0.1f, 0.25f, 1.0f).
 
static std::function< float(float)> createEaseIn ()
 Returns the easing function createCubicBezier (0.42f, 0.0f, 1.0f, 1.0f).
 
static std::function< float(float)> createEaseOut ()
 Returns the easing function createCubicBezier (0.0f, 0.0f, 0.58f, 1.0f).
 
static std::function< float(float)> createEaseOutBack ()
 Returns the easing function createCubicBezier (0.34f, 1.56f, 0.64f, 1.0f).
 
static std::function< float(float)> createEaseInOut ()
 Returns the easing function createCubicBezier (0.42f, 0.0f, 0.58f, 1.0f).
 
static std::function< float(float)> createEaseInOutCubic ()
 Returns the easing function createCubicBezier (0.65f, 0.0f, 0.35f, 1.0f).
 
static std::function< float(float)> createLinear ()
 Returns an easing function with a constant rate of interpolation, with no change in the rate of progress throughout the duration (that is, no acceleration or deceleration).
 
static std::function< float(float)> createSpring (const SpringEasingOptions &options={})
 Returns an easing function that behaves like a spring with a weight attached.
 
static std::function< float(float)> createBounce (int numBounces=3)
 Returns an easing function that behaves like a bouncy ball dropped on the ground.
 
static std::function< float(float)> createOnOffRamp ()
 Returns an easing function that reaches 1.0f when the input value is 0.5f, before returning to 0.0f when the input values reaches 1.0f.
 

Detailed Description

Holds a number of easing functions that you can pass into ValueAnimatorBuilder::withEasing to transform the linear progression of animations.

Using createSpring() for example would transform a rigid movement into one that is reminiscent of a weight attached to a spring.

For examples of all the easing functions see the AnimationEasingDemo in the DemoRunner.

Member Function Documentation

◆ createCubicBezier() [1/2]

static std::function< float(float)> Easings::createCubicBezier ( float x1,
float y1,
float x2,
float y2 )
static

Returns a cubic Bezier function with the control points (x1, y1), (x2, y2).

These points are the two middle points of a cubic Bezier function's four control points, the first and last being (0, 0), and (1, 1).

◆ createCubicBezier() [2/2]

static std::function< float(float)> Easings::createCubicBezier ( Point< float > controlPoint1,
Point< float > controlPoint2 )
static

Returns a cubic Bezier function with two control points.

These points are the two middle points of a cubic Bezier function's four control points, the first and last being (0, 0), and (1, 1).

◆ createEase()

static std::function< float(float)> Easings::createEase ( )
static

Returns the easing function createCubicBezier (0.25f, 0.1f, 0.25f, 1.0f).

This indicates that the interpolation starts slowly, accelerates sharply, and then slows gradually towards the end. It is similar to createEaseInOut(), though it accelerates more sharply at the beginning.

This is equivalent to using the "ease" keyword when specifying a timing-function in CSS.

This is the default easing used by the ValueAnimatorBuilder class if no other easing function is specified.

See also
createCubicBezier, createEaseIn, createEaseOut, createEaseInOut

◆ createEaseIn()

static std::function< float(float)> Easings::createEaseIn ( )
static

Returns the easing function createCubicBezier (0.42f, 0.0f, 1.0f, 1.0f).

This indicates that the interpolation starts slowly, then progressively speeds up until the end, at which point it stops abruptly.

This is equivalent to using the "ease-in" keyword when specifying a timing-function in CSS.

See also
createCubicBezier, createEase, createEaseOut, createEaseInOut

◆ createEaseOut()

static std::function< float(float)> Easings::createEaseOut ( )
static

Returns the easing function createCubicBezier (0.0f, 0.0f, 0.58f, 1.0f).

This indicates that the interpolation starts abruptly and then progressively slows down towards the end.

This is equivalent to using the "ease-out" keyword when specifying a timing-function in CSS.

See also
createCubicBezier, createEase, createEaseIn, createEaseInOut, createEaseOutBack

◆ createEaseOutBack()

static std::function< float(float)> Easings::createEaseOutBack ( )
static

Returns the easing function createCubicBezier (0.34f, 1.56f, 0.64f, 1.0f).

This indicates that the interpolation starts abruptly, quickly decelerating before overshooting the target value by approximately 10% and changing direction to slowly head back towards the target value.

Like createSpring() this will overshoot causing it to return float values exceeding 1.0f.

This is equivalent to easeOutBack as specified on https://easings.net/#easeOutBack.

See also
createCubicBezier, createEaseOutBack, createSpring

◆ createEaseInOut()

static std::function< float(float)> Easings::createEaseInOut ( )
static

Returns the easing function createCubicBezier (0.42f, 0.0f, 0.58f, 1.0f).

This indicates that the interpolation starts slowly, speeds up, and then slows down towards the end. At the beginning, it behaves like createEaseIn(); at the end, it behaves like createEaseOut().

This is equivalent to using the "ease-in-out" keyword when specifying a timing-function in CSS.

See also
createCubicBezier, createEase, createEaseIn, createEaseInOut

◆ createEaseInOutCubic()

static std::function< float(float)> Easings::createEaseInOutCubic ( )
static

Returns the easing function createCubicBezier (0.65f, 0.0f, 0.35f, 1.0f).

This indicates that the interpolation starts slowly, speeds up, and then slows down towards the end. It behaves similar to createEaseInOut() but is more exaggerated and has a more symmetrical curve.

This is equivalent to easeInOutCubic as specified on https://easings.net/#easeInOutCubic.

See also
createCubicBezier, createEaseInOut

◆ createLinear()

static std::function< float(float)> Easings::createLinear ( )
static

Returns an easing function with a constant rate of interpolation, with no change in the rate of progress throughout the duration (that is, no acceleration or deceleration).

◆ createSpring()

static std::function< float(float)> Easings::createSpring ( const SpringEasingOptions & options = {})
static

Returns an easing function that behaves like a spring with a weight attached.

Like createEaseOutBack() this might overshoot causing it to return float values exceeding 1.0f.

See also
createEaseOutBack

◆ createBounce()

static std::function< float(float)> Easings::createBounce ( int numBounces = 3)
static

Returns an easing function that behaves like a bouncy ball dropped on the ground.

The function will bounce numBounces times on the input range of [0, 1] before coming to stop, each bounce is less pronounced than the previous.

This is equivalent to easeInOutCubic as specified on https://easings.net/#easeOutBounce.

◆ createOnOffRamp()

static std::function< float(float)> Easings::createOnOffRamp ( )
static

Returns an easing function that reaches 1.0f when the input value is 0.5f, before returning to 0.0f when the input values reaches 1.0f.

This is useful for making a repeating pulsation.


The documentation for this struct was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram