Skip to content

Commit

Permalink
fix: 调整yoyo是否改变方向逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
hxg2050 committed Mar 1, 2024
1 parent c7ab25c commit f24ac95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "hease",
"private": false,
"version": "0.3.1",
"version": "0.3.2",
"repository": "https://github.com/hxg2050/hease.git",
"license": "MIT",
"main": "./dist/index.cjs.js",
Expand Down
4 changes: 2 additions & 2 deletions src/hease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ export const createUpdate = (fn: (value: number) => void) => {
*/
export const yoyo = (ease = EASE.linear) => {
// 记录方向:1 正向,-1反向
let dir: 1 | -1 = -1;
let dir: 1 | -1 = 1;
// 思路,时间翻倍
const easeFn = (x: number) => {
if (x === 0) {
if (x === 1) {
// 表示应该转向了
dir = -1 * dir;
}
Expand Down

0 comments on commit f24ac95

Please sign in to comment.