@quenty/animations 2.1.1 → 2.1.2-canary.433.80025dc.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 +11 -0
- package/package.json +13 -13
- package/src/Shared/AnimationSlotPlayer.lua +42 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
## [2.1.2-canary.433.80025dc.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animations@2.1.1...@quenty/animations@2.1.2-canary.433.80025dc.0) (2023-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add AnimationSlotPlayer:AdjustWeight() API call ([6e8f586](https://github.com/Quenty/NevermoreEngine/commit/6e8f586afb65303920a78b762d9bc519b30c0ffd))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.1.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animations@2.1.0...@quenty/animations@2.1.1) (2023-10-28)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/animations
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/animations",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2-canary.433.80025dc.0",
|
|
4
4
|
"description": "Utility methods for playing back animations on Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/baseobject": "
|
|
29
|
-
"@quenty/enumutils": "
|
|
30
|
-
"@quenty/humanoidanimatorutils": "
|
|
31
|
-
"@quenty/loader": "
|
|
32
|
-
"@quenty/maid": "
|
|
33
|
-
"@quenty/promise": "
|
|
34
|
-
"@quenty/promisemaid": "
|
|
35
|
-
"@quenty/rbxasset": "
|
|
36
|
-
"@quenty/rx": "
|
|
37
|
-
"@quenty/signal": "
|
|
38
|
-
"@quenty/valueobject": "
|
|
28
|
+
"@quenty/baseobject": "7.0.1-canary.433.80025dc.0",
|
|
29
|
+
"@quenty/enumutils": "3.1.0",
|
|
30
|
+
"@quenty/humanoidanimatorutils": "3.0.0",
|
|
31
|
+
"@quenty/loader": "7.0.1-canary.433.80025dc.0",
|
|
32
|
+
"@quenty/maid": "2.6.0",
|
|
33
|
+
"@quenty/promise": "7.0.1-canary.433.80025dc.0",
|
|
34
|
+
"@quenty/promisemaid": "2.0.1-canary.433.80025dc.0",
|
|
35
|
+
"@quenty/rbxasset": "2.0.1-canary.433.80025dc.0",
|
|
36
|
+
"@quenty/rx": "8.1.2-canary.433.80025dc.0",
|
|
37
|
+
"@quenty/signal": "3.0.1-canary.433.80025dc.0",
|
|
38
|
+
"@quenty/valueobject": "8.1.2-canary.433.80025dc.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "80025dcd926765b502d322bb84e013b973409d8c"
|
|
44
44
|
}
|
|
@@ -22,6 +22,7 @@ function AnimationSlotPlayer.new(animationTarget)
|
|
|
22
22
|
self._defaultFadeTime = self._maid:Add(ValueObject.new(0.1, "number"))
|
|
23
23
|
self._defaultAnimationPriority = self._maid:Add(ValueObject.new(nil))
|
|
24
24
|
self._currentAnimationTrackData = self._maid:Add(ValueObject.new(nil))
|
|
25
|
+
self._currentAnimationId = self._maid:Add(ValueObject.new(nil))
|
|
25
26
|
|
|
26
27
|
if animationTarget then
|
|
27
28
|
self:SetAnimationTarget(animationTarget)
|
|
@@ -46,7 +47,7 @@ end
|
|
|
46
47
|
|
|
47
48
|
function AnimationSlotPlayer:AdjustSpeed(id, speed)
|
|
48
49
|
assert(RbxAssetUtils.isConvertableToRbxAsset(id), "Bad id")
|
|
49
|
-
assert(type(speed) == "number", "Bad
|
|
50
|
+
assert(type(speed) == "number", "Bad speed")
|
|
50
51
|
|
|
51
52
|
local animationId = RbxAssetUtils.toRbxAssetId(id)
|
|
52
53
|
|
|
@@ -83,6 +84,46 @@ function AnimationSlotPlayer:AdjustSpeed(id, speed)
|
|
|
83
84
|
end
|
|
84
85
|
end
|
|
85
86
|
|
|
87
|
+
function AnimationSlotPlayer:AdjustWeight(id, weight, fadeTime)
|
|
88
|
+
assert(RbxAssetUtils.isConvertableToRbxAsset(id), "Bad id")
|
|
89
|
+
assert(type(weight) == "number", "Bad weight")
|
|
90
|
+
assert(type(fadeTime) == "number" or fadeTime == nil, "Bad fadeTime")
|
|
91
|
+
|
|
92
|
+
local animationId = RbxAssetUtils.toRbxAssetId(id)
|
|
93
|
+
|
|
94
|
+
local topMaid = Maid.new()
|
|
95
|
+
|
|
96
|
+
topMaid:GiveTask(self._currentAnimationTrackData:ObserveBrio(function(data)
|
|
97
|
+
return data and data.animationId == animationId
|
|
98
|
+
end):Subscribe(function(brio)
|
|
99
|
+
if brio:IsDead() then
|
|
100
|
+
return
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
local data = brio:GetValue()
|
|
104
|
+
local maid = brio:ToMaid()
|
|
105
|
+
|
|
106
|
+
data.track:AdjustWeight(weight, fadeTime)
|
|
107
|
+
|
|
108
|
+
-- TODO: Use stack here?
|
|
109
|
+
-- TODO: Probably need rogue property mechanisms
|
|
110
|
+
maid:GiveTask(function()
|
|
111
|
+
if math.abs(data.track.Speed - weight) <= 1e-3 then
|
|
112
|
+
data.track:AdjustWeight(data.originalWeight, fadeTime)
|
|
113
|
+
end
|
|
114
|
+
end)
|
|
115
|
+
end))
|
|
116
|
+
|
|
117
|
+
-- TODO: Probably per-a-track instead of global like this
|
|
118
|
+
self._maid._currentWeightAdjustment = topMaid
|
|
119
|
+
|
|
120
|
+
return function()
|
|
121
|
+
if self._maid._currentWeightAdjustment == topMaid then
|
|
122
|
+
self._maid._currentWeightAdjustment = nil
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
86
127
|
function AnimationSlotPlayer:Play(id, fadeTime, weight, speed, priority)
|
|
87
128
|
fadeTime = fadeTime or self._defaultFadeTime.Value
|
|
88
129
|
priority = priority or self._defaultAnimationPriority.Value
|