lv_anim: add typedef int16_t lv_anim_value_t
This commit is contained in:
@@ -669,8 +669,6 @@ static void obj_to_foreground(lv_obj_t * obj)
|
|||||||
|
|
||||||
if(last_top != NULL) {
|
if(last_top != NULL) {
|
||||||
/*Move the last_top object to the foreground*/
|
/*Move the last_top object to the foreground*/
|
||||||
lv_obj_t * par = lv_obj_get_parent(last_top);
|
|
||||||
/*After list change it will be the new head*/
|
|
||||||
lv_obj_move_foreground(last_top);
|
lv_obj_move_foreground(last_top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1421,87 +1421,6 @@ void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj)
|
|||||||
lv_obj_invalidate(obj);
|
lv_obj_invalidate(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LV_USE_ANIMATION
|
|
||||||
/**
|
|
||||||
* Animate an object
|
|
||||||
* @param obj pointer to an object to animate
|
|
||||||
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
|
|
||||||
* @param time time of animation in milliseconds
|
|
||||||
* @param delay delay before the animation in milliseconds
|
|
||||||
* @param ready_cb a function to call when the animation is ready
|
|
||||||
*/
|
|
||||||
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
|
|
||||||
lv_anim_ready_cb_t ready_cb)
|
|
||||||
{
|
|
||||||
lv_obj_t * par = lv_obj_get_parent(obj);
|
|
||||||
|
|
||||||
/*Get the direction*/
|
|
||||||
bool out = (type & LV_ANIM_DIR_MASK) == LV_ANIM_IN ? false : true;
|
|
||||||
type = type & (~LV_ANIM_DIR_MASK);
|
|
||||||
|
|
||||||
lv_anim_t a;
|
|
||||||
a.var = obj;
|
|
||||||
a.time = time;
|
|
||||||
a.act_time = (int32_t)-delay;
|
|
||||||
a.ready_cb = ready_cb;
|
|
||||||
a.path_cb = lv_anim_path_linear;
|
|
||||||
a.playback_pause = 0;
|
|
||||||
a.repeat_pause = 0;
|
|
||||||
a.playback = 0;
|
|
||||||
a.repeat = 0;
|
|
||||||
|
|
||||||
/*Init to ANIM_IN*/
|
|
||||||
switch(type) {
|
|
||||||
case LV_ANIM_FLOAT_LEFT:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
|
|
||||||
a.start = -lv_obj_get_width(obj);
|
|
||||||
a.end = lv_obj_get_x(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_FLOAT_RIGHT:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_x;
|
|
||||||
a.start = lv_obj_get_width(par);
|
|
||||||
a.end = lv_obj_get_x(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_FLOAT_TOP:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
|
|
||||||
a.start = -lv_obj_get_height(obj);
|
|
||||||
a.end = lv_obj_get_y(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_FLOAT_BOTTOM:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_y;
|
|
||||||
a.start = lv_obj_get_height(par);
|
|
||||||
a.end = lv_obj_get_y(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_GROW_H:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_width;
|
|
||||||
a.start = 0;
|
|
||||||
a.end = lv_obj_get_width(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_GROW_V:
|
|
||||||
a.exec_cb = (void (*)(void *, int32_t))lv_obj_set_height;
|
|
||||||
a.start = 0;
|
|
||||||
a.end = lv_obj_get_height(obj);
|
|
||||||
break;
|
|
||||||
case LV_ANIM_NONE:
|
|
||||||
a.exec_cb = NULL;
|
|
||||||
a.start = 0;
|
|
||||||
a.end = 0;
|
|
||||||
break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*Swap start and end in case of ANIM OUT*/
|
|
||||||
if(out != false) {
|
|
||||||
int32_t tmp = a.start;
|
|
||||||
a.start = a.end;
|
|
||||||
a.end = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
lv_anim_create(&a);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*=======================
|
/*=======================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
*======================*/
|
*======================*/
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ extern "C" {
|
|||||||
|
|
||||||
#define LV_MAX_ANCESTOR_NUM 8
|
#define LV_MAX_ANCESTOR_NUM 8
|
||||||
|
|
||||||
#define LV_ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
|
|
||||||
#define LV_ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
|
|
||||||
#define LV_ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/
|
|
||||||
|
|
||||||
#define LV_EXT_CLICK_AREA_OFF 0
|
#define LV_EXT_CLICK_AREA_OFF 0
|
||||||
#define LV_EXT_CLICK_AREA_TINY 1
|
#define LV_EXT_CLICK_AREA_TINY 1
|
||||||
#define LV_EXT_CLICK_AREA_FULL 2
|
#define LV_EXT_CLICK_AREA_FULL 2
|
||||||
@@ -261,17 +257,6 @@ typedef struct
|
|||||||
... [x]: "lv_obj" */
|
... [x]: "lv_obj" */
|
||||||
} lv_obj_type_t;
|
} lv_obj_type_t;
|
||||||
|
|
||||||
enum {
|
|
||||||
LV_ANIM_NONE = 0,
|
|
||||||
LV_ANIM_FLOAT_TOP, /*Float from/to the top*/
|
|
||||||
LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/
|
|
||||||
LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/
|
|
||||||
LV_ANIM_FLOAT_RIGHT, /*Float from/to the right*/
|
|
||||||
LV_ANIM_GROW_H, /*Grow/shrink horizontally*/
|
|
||||||
LV_ANIM_GROW_V, /*Grow/shrink vertically*/
|
|
||||||
};
|
|
||||||
typedef uint8_t lv_anim_builtin_t;
|
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* GLOBAL PROTOTYPES
|
* GLOBAL PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
@@ -623,20 +608,6 @@ void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
|
|||||||
*/
|
*/
|
||||||
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
|
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
|
||||||
|
|
||||||
#if LV_USE_ANIMATION
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Animate an object
|
|
||||||
* @param obj pointer to an object to animate
|
|
||||||
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
|
|
||||||
* @param time time of animation in milliseconds
|
|
||||||
* @param delay delay before the animation in milliseconds
|
|
||||||
* @param ready_cb a function to call when the animation is ready
|
|
||||||
*/
|
|
||||||
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay,
|
|
||||||
lv_anim_ready_cb_t ready_cb);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*=======================
|
/*=======================
|
||||||
* Getter functions
|
* Getter functions
|
||||||
*======================*/
|
*======================*/
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
/**********************
|
/**********************
|
||||||
* STATIC PROTOTYPES
|
* STATIC PROTOTYPES
|
||||||
**********************/
|
**********************/
|
||||||
static void anim_task(void * param);
|
static void anim_task(lv_task_t * param);
|
||||||
static bool anim_ready_handler(lv_anim_t * a);
|
static bool anim_ready_handler(lv_anim_t * a);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
@@ -141,7 +141,7 @@ uint16_t lv_anim_count_running(void)
|
|||||||
* @param end end value of the animation
|
* @param end end value of the animation
|
||||||
* @return the required time [ms] for the animation with the given parameters
|
* @return the required time [ms] for the animation with the given parameters
|
||||||
*/
|
*/
|
||||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end)
|
||||||
{
|
{
|
||||||
int32_t d = LV_MATH_ABS((int32_t)start - end);
|
int32_t d = LV_MATH_ABS((int32_t)start - end);
|
||||||
uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
uint32_t time = (int32_t)((int32_t)(d * 1000) / speed);
|
||||||
@@ -160,14 +160,16 @@ uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_linear(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_linear(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
uint16_t step;
|
uint32_t step;
|
||||||
if(a->time == a->act_time)
|
if(a->time == a->act_time) {
|
||||||
step = LV_ANIM_RESOLUTION; /*Use the last value if the time fully elapsed*/
|
step = LV_ANIM_RESOLUTION; /*Use the last value if the time fully elapsed*/
|
||||||
else
|
}
|
||||||
step = (a->act_time * LV_ANIM_RESOLUTION) / a->time;
|
else {
|
||||||
|
step = ((int32_t)a->act_time * LV_ANIM_RESOLUTION) / a->time;
|
||||||
|
}
|
||||||
|
|
||||||
/* Get the new value which will be proportional to `step`
|
/* Get the new value which will be proportional to `step`
|
||||||
* and the `start` and `end` values*/
|
* and the `start` and `end` values*/
|
||||||
@@ -176,7 +178,7 @@ int32_t lv_anim_path_linear(const lv_anim_t * a)
|
|||||||
new_value = new_value >> LV_ANIM_RES_SHIFT;
|
new_value = new_value >> LV_ANIM_RES_SHIFT;
|
||||||
new_value += a->start;
|
new_value += a->start;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,7 +186,7 @@ int32_t lv_anim_path_linear(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
@@ -200,7 +202,7 @@ int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
|||||||
new_value = new_value >> 10;
|
new_value = new_value >> 10;
|
||||||
new_value += a->start;
|
new_value += a->start;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -208,7 +210,7 @@ int32_t lv_anim_path_ease_in(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
|
|
||||||
@@ -225,7 +227,7 @@ int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
|||||||
new_value = new_value >> 10;
|
new_value = new_value >> 10;
|
||||||
new_value += a->start;
|
new_value += a->start;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -233,7 +235,7 @@ int32_t lv_anim_path_ease_out(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
|
|
||||||
@@ -250,7 +252,7 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
|||||||
new_value = new_value >> 10;
|
new_value = new_value >> 10;
|
||||||
new_value += a->start;
|
new_value += a->start;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,7 +260,7 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
|
|
||||||
@@ -275,7 +277,7 @@ int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
|||||||
new_value = new_value >> 10;
|
new_value = new_value >> 10;
|
||||||
new_value += a->start;
|
new_value += a->start;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -283,7 +285,7 @@ int32_t lv_anim_path_overshoot(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_bounce(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
/*Calculate the current step*/
|
/*Calculate the current step*/
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
@@ -328,12 +330,11 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
|||||||
int32_t step = lv_bezier3(t, 1024, 1024, 800, 0);
|
int32_t step = lv_bezier3(t, 1024, 1024, 800, 0);
|
||||||
|
|
||||||
int32_t new_value;
|
int32_t new_value;
|
||||||
|
|
||||||
new_value = (int32_t)step * diff;
|
new_value = (int32_t)step * diff;
|
||||||
new_value = new_value >> 10;
|
new_value = new_value >> 10;
|
||||||
new_value = a->end - new_value;
|
new_value = a->end - new_value;
|
||||||
|
|
||||||
return new_value;
|
return (lv_anim_value_t)new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -342,7 +343,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a)
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_step(const lv_anim_t * a)
|
lv_anim_value_t lv_anim_path_step(const lv_anim_t * a)
|
||||||
{
|
{
|
||||||
if(a->act_time >= a->time)
|
if(a->act_time >= a->time)
|
||||||
return a->end;
|
return a->end;
|
||||||
@@ -358,7 +359,7 @@ int32_t lv_anim_path_step(const lv_anim_t * a)
|
|||||||
* Periodically handle the animations.
|
* Periodically handle the animations.
|
||||||
* @param param unused
|
* @param param unused
|
||||||
*/
|
*/
|
||||||
static void anim_task(void * param)
|
static void anim_task(lv_task_t * param)
|
||||||
{
|
{
|
||||||
(void)param;
|
(void)param;
|
||||||
|
|
||||||
|
|||||||
@@ -32,13 +32,15 @@ extern "C" {
|
|||||||
* TYPEDEFS
|
* TYPEDEFS
|
||||||
**********************/
|
**********************/
|
||||||
|
|
||||||
|
typedef int16_t lv_anim_value_t; /*Type of the animated value*/
|
||||||
|
|
||||||
struct _lv_anim_t;
|
struct _lv_anim_t;
|
||||||
|
|
||||||
/*Generic prototype of "animator" functions*/
|
/*Generic prototype of "animator" functions*/
|
||||||
typedef void (*lv_anim_exec_cb_t)(void *, int32_t);
|
typedef void (*lv_anim_exec_cb_t)(void *, lv_anim_value_t);
|
||||||
|
|
||||||
/*Get the current value in an animation*/
|
/*Get the current value in an animation*/
|
||||||
typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
|
typedef lv_anim_value_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
|
||||||
|
|
||||||
/*Callback for animation ready*/
|
/*Callback for animation ready*/
|
||||||
typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *);
|
typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *);
|
||||||
@@ -77,7 +79,7 @@ lv_anim_t a;
|
|||||||
a.var = obj;
|
a.var = obj;
|
||||||
a.start = lv_obj_get_height(obj);
|
a.start = lv_obj_get_height(obj);
|
||||||
a.end = new_height;
|
a.end = new_height;
|
||||||
a.exec_cb = (lv_anim_fp_t)lv_obj_set_height;
|
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_height;
|
||||||
a.path_cb = lv_anim_path_linear;
|
a.path_cb = lv_anim_path_linear;
|
||||||
a.ready_cb = NULL;
|
a.ready_cb = NULL;
|
||||||
a.act_time = 0;
|
a.act_time = 0;
|
||||||
@@ -126,49 +128,49 @@ uint16_t lv_anim_count_running(void);
|
|||||||
* @param end end value of the animation
|
* @param end end value of the animation
|
||||||
* @return the required time [ms] for the animation with the given parameters
|
* @return the required time [ms] for the animation with the given parameters
|
||||||
*/
|
*/
|
||||||
uint16_t lv_anim_speed_to_time(uint16_t speed, int32_t start, int32_t end);
|
uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation applying linear characteristic
|
* Calculate the current value of an animation applying linear characteristic
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_linear(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_linear(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation slowing down the start phase
|
* Calculate the current value of an animation slowing down the start phase
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_in(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_ease_in(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation slowing down the end phase
|
* Calculate the current value of an animation slowing down the end phase
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_out(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_ease_out(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation applying an "S" characteristic (cosine)
|
* Calculate the current value of an animation applying an "S" characteristic (cosine)
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_ease_in_out(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation with overshoot at the end
|
* Calculate the current value of an animation with overshoot at the end
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_overshoot(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_overshoot(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation with 3 bounces
|
* Calculate the current value of an animation with 3 bounces
|
||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_bounce(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_bounce(const lv_anim_t * a);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the current value of an animation applying step characteristic.
|
* Calculate the current value of an animation applying step characteristic.
|
||||||
@@ -176,7 +178,7 @@ int32_t lv_anim_path_bounce(const lv_anim_t * a);
|
|||||||
* @param a pointer to an animation
|
* @param a pointer to an animation
|
||||||
* @return the current value to set
|
* @return the current value to set
|
||||||
*/
|
*/
|
||||||
int32_t lv_anim_path_step(const lv_anim_t * a);
|
lv_anim_value_t lv_anim_path_step(const lv_anim_t * a);
|
||||||
|
|
||||||
/**********************
|
/**********************
|
||||||
* MACROS
|
* MACROS
|
||||||
|
|||||||
@@ -202,14 +202,45 @@ void lv_mbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
|
|||||||
|
|
||||||
if(ext->anim_time != 0) {
|
if(ext->anim_time != 0) {
|
||||||
/*Add shrinking animations*/
|
/*Add shrinking animations*/
|
||||||
lv_obj_animate(mbox, LV_ANIM_GROW_H | LV_ANIM_OUT, ext->anim_time, delay, NULL);
|
lv_anim_t a;
|
||||||
lv_obj_animate(mbox, LV_ANIM_GROW_V | LV_ANIM_OUT, ext->anim_time, delay,
|
a.var = mbox;
|
||||||
lv_mbox_close_ready_cb);
|
a.start = lv_obj_get_height(mbox);
|
||||||
|
a.end = 0;
|
||||||
|
a.exec_cb = (lv_anim_exec_cb_t)lv_obj_set_height;
|
||||||
|
a.path_cb = lv_anim_path_linear;
|
||||||
|
a.ready_cb = NULL;
|
||||||
|
a.act_time = -delay;
|
||||||
|
a.time = ext->anim_time;
|
||||||
|
a.playback = 0;
|
||||||
|
a.playback_pause = 0;
|
||||||
|
a.repeat = 0;
|
||||||
|
a.repeat_pause = 0;
|
||||||
|
a.user_data = NULL;
|
||||||
|
lv_anim_create(&a);
|
||||||
|
|
||||||
|
a.start = lv_obj_get_width(mbox);
|
||||||
|
a.ready_cb = lv_mbox_close_ready_cb;
|
||||||
|
lv_anim_create(&a);
|
||||||
|
|
||||||
/*Disable fit to let shrinking work*/
|
/*Disable fit to let shrinking work*/
|
||||||
lv_cont_set_fit(mbox, LV_FIT_NONE);
|
lv_cont_set_fit(mbox, LV_FIT_NONE);
|
||||||
} else {
|
} else {
|
||||||
lv_obj_animate(mbox, LV_ANIM_NONE, ext->anim_time, delay, lv_mbox_close_ready_cb);
|
/*Create an animation to delete the mbox `delay` ms later*/
|
||||||
|
lv_anim_t a;
|
||||||
|
a.var = mbox;
|
||||||
|
a.start = 0;
|
||||||
|
a.end = 1;
|
||||||
|
a.exec_cb = (lv_anim_exec_cb_t)NULL;
|
||||||
|
a.path_cb = lv_anim_path_linear;
|
||||||
|
a.ready_cb = lv_mbox_close_ready_cb;
|
||||||
|
a.act_time = -delay;
|
||||||
|
a.time = 0;
|
||||||
|
a.playback = 0;
|
||||||
|
a.playback_pause = 0;
|
||||||
|
a.repeat = 0;
|
||||||
|
a.repeat_pause = 0;
|
||||||
|
a.user_data = NULL;
|
||||||
|
lv_anim_create(&a);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
(void)delay; /*Unused*/
|
(void)delay; /*Unused*/
|
||||||
|
|||||||
Reference in New Issue
Block a user