@quenty/spring 3.0.0-canary.236.5597d0a.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/package.json +3 -3
- package/src/Shared/SpringUtils.lua +11 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
# [3.0.0
|
|
6
|
+
# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spring@2.2.0...@quenty/spring@3.0.0) (2021-12-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add spring support for UDim2 and UDim and Vector2 ([d1763d7](https://github.com/Quenty/NevermoreEngine/commit/d1763d7cdc65ad5df4bbe38897cd9a446bb61bb1))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/spring@2.1.0...@quenty/spring@2.2.0) (2021-12-18)
|
|
7
18
|
|
|
8
19
|
|
|
9
20
|
### Features
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/spring",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Spring implementation for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@quenty/loader": "3.1.1"
|
|
32
|
+
"@quenty/loader": "^3.1.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "3a3d03785e31c5b53d27d1fff519a53c695fbc19"
|
|
35
35
|
}
|
|
@@ -19,11 +19,14 @@ function SpringUtils.animating(spring, epsilon)
|
|
|
19
19
|
if type(target) == "number" then
|
|
20
20
|
animating = math.abs(spring.Position - spring.Target) > epsilon
|
|
21
21
|
or math.abs(spring.Velocity) > epsilon
|
|
22
|
-
elseif typeof(target) == "Vector3" or LinearValue.isLinear(target) then
|
|
23
|
-
animating = (spring.Position - spring.Target).magnitude > epsilon
|
|
24
|
-
or spring.Velocity.magnitude > epsilon
|
|
25
22
|
else
|
|
26
|
-
|
|
23
|
+
local rbxtype = typeof(target)
|
|
24
|
+
if rbxtype == "Vector3" or rbxtype == "Vector2" or LinearValue.isLinear(target) then
|
|
25
|
+
animating = (spring.Position - spring.Target).magnitude > epsilon
|
|
26
|
+
or spring.Velocity.magnitude > epsilon
|
|
27
|
+
else
|
|
28
|
+
error("Unknown type")
|
|
29
|
+
end
|
|
27
30
|
end
|
|
28
31
|
|
|
29
32
|
if animating then
|
|
@@ -46,6 +49,10 @@ end
|
|
|
46
49
|
function SpringUtils.toLinearIfNeeded(value)
|
|
47
50
|
if typeof(value) == "Color3" then
|
|
48
51
|
return LinearValue.new(Color3.new, {value.r, value.g, value.b})
|
|
52
|
+
elseif typeof(value) == "UDim2" then
|
|
53
|
+
return LinearValue.new(UDim2.new, {value.x.scale, value.x.offset, value.y.scale, value.y.offset})
|
|
54
|
+
elseif typeof(value) == "UDim" then
|
|
55
|
+
return LinearValue.new(UDim.new, {value.scale, value.offset})
|
|
49
56
|
else
|
|
50
57
|
return value
|
|
51
58
|
end
|