Open 3D Engine AzFramework API Reference 26.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::EasingCurve Class Reference

An easing curve is a collection of points that define a curve. The points are arranged by ascending time. More...

#include <EasingCurve.h>

Classes

struct  Point
 A single point in the easing curve. Both m_time and m_value are in the range [0, 1]. More...
 

Public Types

enum class  PointInterpolationMode : AZ::u8 {
  LINEAR = 0 , STEP , CUBIC_IN , CUBIC_OUT ,
  SINE_IN , SINE_OUT , CIRCLE_IN , CIRCLE_OUT
}
 

Public Member Functions

 AZ_CLASS_ALLOCATOR (EasingCurve, AZ::SystemAllocator, 0)
 
 AZ_TYPE_INFO (EasingCurve, "{D4B7E91C-DD02-423E-B8BC-699E0DFC249B}")
 
 EasingCurve (const EasingCurve &)=default
 
 EasingCurve (EasingCurve &&)=default
 
EasingCurve & operator= (const EasingCurve &)=default
 
EasingCurve & operator= (EasingCurve &&)=default
 
 EasingCurve (AZStd::initializer_list< Point > points)
 Construct an easing curve from a list of points.
 
void SetDefaultValue ()
 Sets the default value for the easing curve.
 
int64_t GetNumPoints () const
 Returns the number of points in the easing curve.
 
Point GetPoint (int64_t index)
 
int64_t UpdatePoint (int64_t index, Point point)
 Updates the point at the given index with the provided point data. (The point's index might be changed if it no longer fits in the same position after the update, but the point will still be updated with the new data)
 
int64_t AddPoint (Point point)
 
void RemovePoint (int64_t index)
 
void Clear ()
 Removes all points from the easing curve.
 
float Evaluate (float time) const
 
int64_t GetClosetPoint (float time, float value)
 

Static Public Member Functions

static void Reflect (AZ::ReflectContext *context)
 
static float Interpolate (const Point &start, const Point &end, float time)
 

Detailed Description

An easing curve is a collection of points that define a curve. The points are arranged by ascending time.

Constructor & Destructor Documentation

◆ EasingCurve()

AzFramework::EasingCurve::EasingCurve ( AZStd::initializer_list< Point >  points)

Construct an easing curve from a list of points.

This constructor will add all points in the given list to the easing curve and then sort them.

Member Function Documentation

◆ AddPoint()

int64_t AzFramework::EasingCurve::AddPoint ( Point  point)

Adds a new point to the easing curve.

Parameters
pointThe point to be added to the easing curve.

◆ Evaluate()

float AzFramework::EasingCurve::Evaluate ( float  time) const

Evaluates the easing curve at the given time and returns the corresponding value.

Parameters
timeThe time at which to evaluate the easing curve.
Returns
The value of the easing curve at the given time.

◆ GetClosetPoint()

int64_t AzFramework::EasingCurve::GetClosetPoint ( float  time,
float  value 
)

Finds the point in the curve that is closest to the given time and value.

Parameters
timeThe time to compare against the points in the curve.
valueThe value to compare against the points in the curve.
Returns
A reference to the point in the curve that is closest to the given time and value.

◆ GetPoint()

Point AzFramework::EasingCurve::GetPoint ( int64_t  index)

Returns the point at the given index.

Parameters
indexThe index of the point to retrieve.
Returns
The point at the given index.

◆ Interpolate()

static float AzFramework::EasingCurve::Interpolate ( const Point &  start,
const Point &  end,
float  time 
)
static

Interpolates between the start and end points based on the given time and the interpolation mode of the end point.

Parameters
startThe start point of the interpolation.
endThe end point of the interpolation.
timeThe time at which to interpolate between the start and end points.
Returns
The interpolated value between the start and end points at the given time.

◆ RemovePoint()

void AzFramework::EasingCurve::RemovePoint ( int64_t  index)

Removes the point at the given index from the easing curve.

Parameters
indexThe index of the point to be removed.

◆ UpdatePoint()

int64_t AzFramework::EasingCurve::UpdatePoint ( int64_t  index,
Point  point 
)

Updates the point at the given index with the provided point data. (The point's index might be changed if it no longer fits in the same position after the update, but the point will still be updated with the new data)

Parameters
indexThe index of the point to be updated
pointThe updated point data to replace the existing point at the specified index

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