Implements a progressive deceleration phase for the shake emotion using a cubic ease-out, replacing the previous abrupt stop logic. Adds the shy.json animation asset for the 'shy' emotion. Updates lottie_player to properly delete existing blink timers before scheduling a new one. Also includes minor header and enum adjustments for shake_emotion.
68 lines
1.4 KiB
C
68 lines
1.4 KiB
C
/**
|
|
* @file shake_emotion.h
|
|
* @brief Shaking animation controller
|
|
*
|
|
* Manages the shaking Lottie animation that plays when the device
|
|
* is being continuously shaken, and the shake-stop transition animation.
|
|
*/
|
|
|
|
#ifndef SHAKE_EMOTION_H
|
|
#define SHAKE_EMOTION_H
|
|
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @brief Initialize the shake emotion module
|
|
*
|
|
* @return true on success, false on failure
|
|
*/
|
|
bool shakeEmotionInit(void);
|
|
|
|
/**
|
|
* @brief Start playing the shaking animation
|
|
*
|
|
* Animation will loop until shakeEmotionBeginStop() is called.
|
|
*/
|
|
void shakeEmotionPlay(void);
|
|
|
|
/**
|
|
* @brief Begin stopping the shake animation
|
|
*
|
|
* Finishes the current shaking loop, then plays the shake-stop transition.
|
|
* Call shakeEmotionUpdate() to poll for completion.
|
|
*/
|
|
void shakeEmotionBeginStop(void);
|
|
|
|
/**
|
|
* @brief Update the shake stop transition
|
|
*
|
|
* Must be called periodically to complete the shake-stop transition.
|
|
*
|
|
* @return true if transition is complete and ready for idle, false if still
|
|
* transitioning
|
|
*/
|
|
bool shakeEmotionUpdate(void);
|
|
|
|
/**
|
|
* @brief Stop the shaking animation immediately (for cleanup)
|
|
*/
|
|
void shakeEmotionStop(void);
|
|
|
|
/**
|
|
* @brief Check if shaking animation is currently playing
|
|
*
|
|
* @return true if playing, false otherwise
|
|
*/
|
|
bool shakeEmotionIsPlaying(void);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // SHAKE_EMOTION_H
|