Gama C Library
Gama C API Documentation
Loading...
Searching...
No Matches
animate.h File Reference

Functions for animating values with various easing functions. More...

#include "gapi.h"
#include <math.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void gm_anim_spring (double *value, double target, double t)
 Moves a value towards a target with spring-like motion (exponential ease-out).
void gm_anim_ease_out_quad (double *value, const double target, double t)
 Starts fast and decelerates quadratically to the target. More pronounced than spring.
void gm_anim_ease_out_cubic (double *value, double target, double t)
 Starts very fast and decelerates cubically to the target. More pronounced than quad.
void gm_anim_ease_in_quad (double *value, double target, double t)
 Starts slow and accelerates quadratically towards the target.

Detailed Description

Functions for animating values with various easing functions.

General notes on animation functions:

  • value: A pointer to the variable to be animated.
  • target: The target value to animate towards.
  • t: The approximate time the animation should take (in seconds). It acts as a time constant.

Function Documentation

◆ gm_anim_ease_in_quad()

void gm_anim_ease_in_quad ( double * value,
double target,
double t )

Starts slow and accelerates quadratically towards the target.

Parameters
valueA pointer to the double value to animate.
targetThe target value to animate towards.
tThe animation's approximate duration.

◆ gm_anim_ease_out_cubic()

void gm_anim_ease_out_cubic ( double * value,
double target,
double t )

Starts very fast and decelerates cubically to the target. More pronounced than quad.

Parameters
valueA pointer to the double value to animate.
targetThe target value to animate towards.
tThe animation's approximate duration.

◆ gm_anim_ease_out_quad()

void gm_anim_ease_out_quad ( double * value,
const double target,
double t )

Starts fast and decelerates quadratically to the target. More pronounced than spring.

Parameters
valueA pointer to the double value to animate.
targetThe target value to animate towards.
tThe animation's approximate duration.

◆ gm_anim_spring()

void gm_anim_spring ( double * value,
double target,
double t )

Moves a value towards a target with spring-like motion (exponential ease-out).

Parameters
valueA pointer to the double value to animate.
targetThe target value to animate towards.
tThe animation's approximate duration. A smaller 't' results in a faster animation.