/**1* @file anim.h2*3*/45#ifndef ANIM_H6#define ANIM_H78#ifdef __cplusplus9extern "C" {10#endif111213/*********************14* INCLUDES15*********************/16#ifdef LV_CONF_INCLUDE_SIMPLE17#include "lv_conf.h"18#else19#include "../../lv_conf.h"20#endif2122#if USE_LV_ANIMATION2324#include <stdint.h>2526/*********************27* DEFINES28*********************/2930/**********************31* TYPEDEFS32**********************/3334struct _lv_anim_t;3536typedef int32_t(*lv_anim_path_t)(const struct _lv_anim_t*);3738typedef void (*lv_anim_fp_t)(void *, int32_t);39typedef void (*lv_anim_cb_t)(void *);4041typedef struct _lv_anim_t42{43void * var; /*Variable to animate*/44lv_anim_fp_t fp; /*Animator function*/45lv_anim_cb_t end_cb; /*Call it when the animation is ready*/46lv_anim_path_t path; /*An array with the steps of animations*/47int32_t start; /*Start value*/48int32_t end; /*End value*/49uint16_t time; /*Animation time in ms*/50int16_t act_time; /*Current time in animation. Set to negative to make delay.*/51uint16_t playback_pause; /*Wait before play back*/52uint16_t repeat_pause; /*Wait before repeat*/53uint8_t playback :1; /*When the animation is ready play it back*/54uint8_t repeat :1; /*Repeat the animation infinitely*/55/*Animation system use these - user shouldn't set*/56uint8_t playback_now :1; /*Play back is in progress*/57uint32_t has_run :1; /*Indicates the animation has run it this round*/58} lv_anim_t;5960/*Example initialization61lv_anim_t a;62a.var = obj;63a.start = lv_obj_get_height(obj);64a.end = new_height;65a.fp = (lv_anim_fp_t)lv_obj_set_height;66a.path = lv_anim_path_linear;67a.end_cb = NULL;68a.act_time = 0;69a.time = 200;70a.playback = 0;71a.playback_pause = 0;72a.repeat = 0;73a.repeat_pause = 0;74lv_anim_create(&a);75*/76/**********************77* GLOBAL PROTOTYPES78**********************/7980/**81* Init. the animation module82*/83void lv_anim_init(void);8485/**86* Create an animation87* @param anim_p an initialized 'anim_t' variable. Not required after call.88*/89void lv_anim_create(lv_anim_t * anim_p);9091/**92* Delete an animation for a variable with a given animatior function93* @param var pointer to variable94* @param fp a function pointer which is animating 'var',95* or NULL to ignore it and delete all animation with 'var96* @return true: at least 1 animation is deleted, false: no animation is deleted97*/98bool lv_anim_del(void * var, lv_anim_fp_t fp);99100/**101* Get the number of currently running animations102* @return the number of running animations103*/104uint16_t lv_anim_count_running(void);105106/**107* Calculate the time of an animation with a given speed and the start and end values108* @param speed speed of animation in unit/sec109* @param start start value of the animation110* @param end end value of the animation111* @return the required time [ms] for the animation with the given parameters112*/113uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);114115/**116* Calculate the current value of an animation applying linear characteristic117* @param a pointer to an animation118* @return the current value to set119*/120int32_t lv_anim_path_linear(const lv_anim_t *a);121122/**123* Calculate the current value of an animation slowing down the start phase124* @param a pointer to an animation125* @return the current value to set126*/127int32_t lv_anim_path_ease_in(const lv_anim_t * a);128129/**130* Calculate the current value of an animation slowing down the end phase131* @param a pointer to an animation132* @return the current value to set133*/134int32_t lv_anim_path_ease_out(const lv_anim_t * a);135136/**137* Calculate the current value of an animation applying an "S" characteristic (cosine)138* @param a pointer to an animation139* @return the current value to set140*/141int32_t lv_anim_path_ease_in_out(const lv_anim_t *a);142143/**144* Calculate the current value of an animation with overshoot at the end145* @param a pointer to an animation146* @return the current value to set147*/148int32_t lv_anim_path_overshoot(const lv_anim_t * a);149150/**151* Calculate the current value of an animation with 3 bounces152* @param a pointer to an animation153* @return the current value to set154*/155int32_t lv_anim_path_bounce(const lv_anim_t * a);156157/**158* Calculate the current value of an animation applying step characteristic.159* (Set end value on the end of the animation)160* @param a pointer to an animation161* @return the current value to set162*/163int32_t lv_anim_path_step(const lv_anim_t *a);164/**********************165* MACROS166**********************/167168#endif /*USE_LV_ANIMATION == 0*/169170#ifdef __cplusplus171} /* extern "C" */172#endif173174#endif /*LV_ANIM_H*/175176177178