Skip to content

Commit

Permalink
add path ease out back half
Browse files Browse the repository at this point in the history
  • Loading branch information
Forairaaaaa committed Nov 17, 2024
1 parent cf92a10 commit 577fbcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/easing_path/easing_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ namespace SmoothUIToolKit
return static_cast<int>(ft * maxT);
}

int easeOutBackHalf(const int& t)
{
// 减小回弹幅度的一半
constexpr fpm::fixed_16_16 c1_half{0.85079};
constexpr fpm::fixed_16_16 c3_half{0.85079 + 1};

fpm::fixed_16_16 ft{t};
ft = ft / maxT;
ft = 1 + c3_half * fpm::pow(ft - 1, 3) + c1_half * fpm::pow(ft - 1, 2);
return static_cast<int>(ft * maxT);
}

int easeInOutBack(const int& t)
{
fpm::fixed_16_16 ft{t};
Expand Down
1 change: 1 addition & 0 deletions src/core/easing_path/easing_path.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ namespace SmoothUIToolKit
int easeInOutCirc(const int& t);
int easeInBack(const int& t);
int easeOutBack(const int& t);
int easeOutBackHalf(const int& t);
int easeInOutBack(const int& t);
int easeInElastic(const int& t);
int easeOutElastic(const int& t);
Expand Down

0 comments on commit 577fbcf

Please sign in to comment.