From 621f40764a3fd3324f425cff6017dde310a08844 Mon Sep 17 00:00:00 2001 From: Christopher <51393127+chriscerie@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:17:01 -0700 Subject: [PATCH 1/5] Fix calculations not responding to fps differences --- src/SpringValue.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/SpringValue.lua b/src/SpringValue.lua index 5ec5a3f..2407225 100644 --- a/src/SpringValue.lua +++ b/src/SpringValue.lua @@ -218,8 +218,7 @@ function SpringValue:advance(dt: number) -- When `true`, the value is increasing over time local isGrowing = if from == to then _v0 > 0 else from < to - local step = 1 -- 1ms - local numSteps = math.ceil(dt / step) * 10 + local numSteps = math.ceil(dt * 1000 / 2) for _ = 0, numSteps do local isMoving = math.abs(velocity) > restVelocity @@ -229,7 +228,7 @@ function SpringValue:advance(dt: number) break end end - + if canBounce then local isBouncing = position == to or position > to == isGrowing @@ -244,8 +243,8 @@ function SpringValue:advance(dt: number) local dampingForce = -config.friction * 0.001 * velocity local acceleration = (springForce + dampingForce) / config.mass -- pt/ms^2 - velocity = velocity + acceleration * step -- pt/ms - position = position + velocity * step + velocity = velocity + acceleration -- pt/ms + position = position + velocity end end From 296ee01e4f7b15773b90bb13e89b1a553438649a Mon Sep 17 00:00:00 2001 From: Christopher <51393127+chriscerie@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:17:54 -0700 Subject: [PATCH 2/5] Bump promise to v4 and roact-hooks v0.4 --- wally.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wally.toml b/wally.toml index c866ac5..d66b95a 100644 --- a/wally.toml +++ b/wally.toml @@ -9,6 +9,6 @@ realm = "shared" [dependencies] Roact = "roblox/roact@^1" -Promise = "evaera/promise@^3.2" -Hooks = "kampfkarren/roact-hooks@^0.3" +Promise = "evaera/promise@^4.0" +Hooks = "kampfkarren/roact-hooks@^0.4" TestEZ = "roblox/testez@^0.4" \ No newline at end of file From 7fbe3dfdad93558deae48dd1129bd03619e564fb Mon Sep 17 00:00:00 2001 From: Christopher <51393127+chriscerie@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:28:12 -0700 Subject: [PATCH 3/5] Bump roact-spring to 1.0.0 --- wally.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wally.toml b/wally.toml index d66b95a..e46d482 100644 --- a/wally.toml +++ b/wally.toml @@ -1,7 +1,7 @@ [package] name = "chriscerie/roact-spring" description = "A modern spring-physics based animation library for Roact inspired by react-spring" -version = "0.3.1" +version = "1.0.0" license = "MIT" authors = ["chriscerie"] registry = "https://github.com/UpliftGames/wally-index" From 17cdbb9819764d759c32227d61c3862b1bffe43b Mon Sep 17 00:00:00 2001 From: Christopher <51393127+chriscerie@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:30:40 -0700 Subject: [PATCH 4/5] Bump ts version to 1.0.0-ts.0 --- CHANGELOG.md | 7 ++++++- package.json | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1b65f..4124ab8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ ## Unreleased -# 0.3.1 (March 29, 2022) +## 1.0.0 (April 21, 2022) +* Bumped promise version to v4.0 +* Bumped roact-hooks version to v0.4 +* Fixed calculations not responding to fps differences + +## 0.3.1 (March 29, 2022) * Fixed an issue where duration-based anims would always start from the same position ## 0.3.0 (March 29, 2022) diff --git a/package.json b/package.json index 547752a..9ad6736 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rbxts/roact-spring", - "version": "0.3.1-ts.0", + "version": "1.0.0-ts.0", "description": "A modern spring-physics based animation library for Roact inspired by react-spring", "main": "src/init.lua", "typings": "src/index.d.ts", From 8930da6379bbeeb806a7d2a3d783824dd59ea445 Mon Sep 17 00:00:00 2001 From: Christopher <51393127+chriscerie@users.noreply.github.com> Date: Thu, 21 Apr 2022 14:30:52 -0700 Subject: [PATCH 5/5] Update changelog --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4124ab8..5c11f6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,9 +3,9 @@ ## Unreleased ## 1.0.0 (April 21, 2022) -* Bumped promise version to v4.0 -* Bumped roact-hooks version to v0.4 -* Fixed calculations not responding to fps differences +* Bumped promise version to v4.0 ([@chriscerie](https://github.com/chriscerie) in [#20](https://github.com/chriscerie/roact-spring/pull/20)) +* Bumped roact-hooks version to v0.4 ([@chriscerie](https://github.com/chriscerie) in [#20](https://github.com/chriscerie/roact-spring/pull/20)) +* Fixed calculations not responding to fps differences ([@chriscerie](https://github.com/chriscerie) in [#20](https://github.com/chriscerie/roact-spring/pull/20)) ## 0.3.1 (March 29, 2022) * Fixed an issue where duration-based anims would always start from the same position