diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a1b65f..5c11f6f 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 ([@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 ## 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", 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 diff --git a/wally.toml b/wally.toml index c866ac5..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" @@ -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