mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-05 01:40:57 -05:00
opt: animations logic all use the int type
avoid the coordinates being forcibly limited to positive numbers
This commit is contained in:
parent
0d13b1002e
commit
2771053ee6
21 changed files with 876 additions and 861 deletions
|
|
@ -1,4 +1,4 @@
|
|||
struct dvec2 calculate_animation_curve_at(double t, int type) {
|
||||
struct dvec2 calculate_animation_curve_at(double t, int32_t type) {
|
||||
struct dvec2 point;
|
||||
double *animation_curve;
|
||||
if (type == MOVE) {
|
||||
|
|
@ -41,41 +41,41 @@ void init_baked_points(void) {
|
|||
baked_points_opafadeout =
|
||||
calloc(BAKED_POINTS_COUNT, sizeof(*baked_points_opafadeout));
|
||||
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_move[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), MOVE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_open[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPEN);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_tag[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), TAG);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_close[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), CLOSE);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_focus[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), FOCUS);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_opafadein[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPAFADEIN);
|
||||
}
|
||||
for (uint32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
for (int32_t i = 0; i < BAKED_POINTS_COUNT; i++) {
|
||||
baked_points_opafadeout[i] = calculate_animation_curve_at(
|
||||
(double)i / (BAKED_POINTS_COUNT - 1), OPAFADEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
double find_animation_curve_at(double t, int type) {
|
||||
uint32_t down = 0;
|
||||
uint32_t up = BAKED_POINTS_COUNT - 1;
|
||||
double find_animation_curve_at(double t, int32_t type) {
|
||||
int32_t down = 0;
|
||||
int32_t up = BAKED_POINTS_COUNT - 1;
|
||||
|
||||
uint32_t middle = (up + down) / 2;
|
||||
int32_t middle = (up + down) / 2;
|
||||
struct dvec2 *baked_points;
|
||||
if (type == MOVE) {
|
||||
baked_points = baked_points_move;
|
||||
|
|
@ -106,7 +106,8 @@ double find_animation_curve_at(double t, int type) {
|
|||
return baked_points[up].y;
|
||||
}
|
||||
|
||||
static bool scene_node_snapshot(struct wlr_scene_node *node, int lx, int ly,
|
||||
static bool scene_node_snapshot(struct wlr_scene_node *node, int32_t lx,
|
||||
int32_t ly,
|
||||
struct wlr_scene_tree *snapshot_tree) {
|
||||
if (!node->enabled && node->type != WLR_SCENE_NODE_TREE) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue