@quenty/animationgroup 3.1.3-canary.c50dead.0 → 3.2.1
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 +10 -2
- package/LICENSE.md +1 -1
- package/README.md +6 -14
- package/package.json +6 -6
- package/src/Shared/AnimationGroup.lua +19 -5
- package/src/Shared/AnimationGroupUtils.lua +46 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,12 +3,20 @@
|
|
|
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.1
|
|
6
|
+
## [3.2.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animationgroup@3.2.0...@quenty/animationgroup@3.2.1) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/animationgroup
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/animationgroup@3.1.2...@quenty/animationgroup@3.2.0) (2021-11-20)
|
|
7
15
|
|
|
8
16
|
|
|
9
17
|
### Bug Fixes
|
|
10
18
|
|
|
11
|
-
* Support MacOS syncing ([
|
|
19
|
+
* Support MacOS syncing ([#225](https://github.com/Quenty/NevermoreEngine/issues/225)) ([03f9183](https://github.com/Quenty/NevermoreEngine/commit/03f918392c6a5bdd33f8a17c38de371d1e06c67a))
|
|
12
20
|
|
|
13
21
|
|
|
14
22
|
|
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
## AnimationGroup
|
|
2
2
|
<div align="center">
|
|
3
|
-
<a href="http://quenty.github.io/
|
|
4
|
-
<img src="https://
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
-
<img src="https://img.shields.io/
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
10
|
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
@@ -13,17 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
A group of weighted tracks that can be played back with weighted probability. The closest example to this is the idle animation that looks around at a 1:10 ratio when you're standing still in default Roblox animation script.
|
|
15
15
|
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/AnimationGroup">View docs →</a></div>
|
|
17
|
+
|
|
16
18
|
## Installation
|
|
17
19
|
```
|
|
18
20
|
npm install @quenty/animationgroup --save
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
Usage is designed to be simple.
|
|
23
|
-
|
|
24
|
-
### `AnimationGroup.new(weightedTracks)`
|
|
25
|
-
|
|
26
|
-
### `AnimationGroup:Play(transitionTime)`
|
|
27
|
-
|
|
28
|
-
### `AnimationGroup:Stop(transitionTime)`
|
|
29
|
-
|
|
21
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/animationgroup",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "A group of weighted tracks that can be played back with weighted probability. The closest example to this is the idle animation that looks around at a 1:10 ratio when you're standing still in default Roblox animation script.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"Quenty"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@quenty/animationtrackutils": "2.0.
|
|
30
|
-
"@quenty/baseobject": "3.1
|
|
31
|
-
"@quenty/loader": "3.1.
|
|
32
|
-
"@quenty/maid": "2.0.
|
|
29
|
+
"@quenty/animationtrackutils": "^2.0.1",
|
|
30
|
+
"@quenty/baseobject": "^3.2.1",
|
|
31
|
+
"@quenty/loader": "^3.1.2",
|
|
32
|
+
"@quenty/maid": "^2.0.2"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
|
|
38
38
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
A group of weighted tracks that can be played back with weighted probability.
|
|
3
|
+
The closest example to this is the idle animation that looks around at a 1:10
|
|
4
|
+
ratio when you're standing still in default Roblox animation script.
|
|
5
|
+
|
|
6
|
+
@class AnimationGroup
|
|
7
|
+
]=]
|
|
5
8
|
|
|
6
9
|
local require = require(script.Parent.loader).load(script)
|
|
7
10
|
|
|
@@ -13,6 +16,10 @@ local AnimationGroup = setmetatable({}, BaseObject)
|
|
|
13
16
|
AnimationGroup.ClassName = "AnimationGroup"
|
|
14
17
|
AnimationGroup.__index = AnimationGroup
|
|
15
18
|
|
|
19
|
+
--[=[
|
|
20
|
+
@param weightedTracks { WeightedTrack }
|
|
21
|
+
@return AnimationGroup
|
|
22
|
+
]=]
|
|
16
23
|
function AnimationGroup.new(weightedTracks)
|
|
17
24
|
local self = setmetatable(BaseObject.new(), AnimationGroup)
|
|
18
25
|
|
|
@@ -29,6 +36,10 @@ function AnimationGroup.new(weightedTracks)
|
|
|
29
36
|
return self
|
|
30
37
|
end
|
|
31
38
|
|
|
39
|
+
--[=[
|
|
40
|
+
Plays the animations
|
|
41
|
+
@param transitionTime number
|
|
42
|
+
]=]
|
|
32
43
|
function AnimationGroup:Play(transitionTime)
|
|
33
44
|
if self._currentTrack and self._currentTrack.IsPlaying then
|
|
34
45
|
return
|
|
@@ -36,7 +47,10 @@ function AnimationGroup:Play(transitionTime)
|
|
|
36
47
|
|
|
37
48
|
self:_playNewTrack(transitionTime)
|
|
38
49
|
end
|
|
39
|
-
|
|
50
|
+
--[=[
|
|
51
|
+
Stops the animations
|
|
52
|
+
@param transitionTime number
|
|
53
|
+
]=]
|
|
40
54
|
function AnimationGroup:Stop(transitionTime)
|
|
41
55
|
if self._currentTrack then
|
|
42
56
|
self._currentTrack:Stop(transitionTime)
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
An animation group is a group of animations, such as the idle animations that Roblox plays.
|
|
3
|
+
This utility functions are intended to help recreate a custom animation playback system with
|
|
4
|
+
weighted values.
|
|
5
|
+
@class AnimationGroupUtils
|
|
6
|
+
]=]
|
|
3
7
|
|
|
4
8
|
local require = require(script.Parent.loader).load(script)
|
|
5
9
|
|
|
@@ -7,6 +11,26 @@ local AnimationTrackUtils = require("AnimationTrackUtils")
|
|
|
7
11
|
|
|
8
12
|
local AnimationGroupUtils = {}
|
|
9
13
|
|
|
14
|
+
--[=[
|
|
15
|
+
@interface WeightedAnimation
|
|
16
|
+
.animationId string
|
|
17
|
+
.weight number
|
|
18
|
+
@within AnimationGroupUtils
|
|
19
|
+
]=]
|
|
20
|
+
|
|
21
|
+
--[=[
|
|
22
|
+
@interface WeightedTrack
|
|
23
|
+
.track Track
|
|
24
|
+
.weight number
|
|
25
|
+
@within AnimationGroupUtils
|
|
26
|
+
]=]
|
|
27
|
+
|
|
28
|
+
--[=[
|
|
29
|
+
Creates a new weighted track list.
|
|
30
|
+
@param humanoid Humanoid
|
|
31
|
+
@param weightedAnimationList { WeightedAnimation }
|
|
32
|
+
@return { WeightedTrack }
|
|
33
|
+
]=]
|
|
10
34
|
function AnimationGroupUtils.createdWeightedTracks(humanoid, weightedAnimationList)
|
|
11
35
|
assert(humanoid, "Bad humanoid")
|
|
12
36
|
assert(weightedAnimationList, "Bad weightedAnimationList")
|
|
@@ -23,6 +47,13 @@ function AnimationGroupUtils.createdWeightedTracks(humanoid, weightedAnimationLi
|
|
|
23
47
|
return tracks
|
|
24
48
|
end
|
|
25
49
|
|
|
50
|
+
--[=[
|
|
51
|
+
Creates a new weighted animation.
|
|
52
|
+
|
|
53
|
+
@param animationId string
|
|
54
|
+
@param weight number
|
|
55
|
+
@return WeightedAnimation
|
|
56
|
+
]=]
|
|
26
57
|
function AnimationGroupUtils.createdWeightedAnimation(animationId, weight)
|
|
27
58
|
assert(type(animationId) == "string", "Bad animationId")
|
|
28
59
|
assert(type(weight) == "number", "Bad weight")
|
|
@@ -33,6 +64,13 @@ function AnimationGroupUtils.createdWeightedAnimation(animationId, weight)
|
|
|
33
64
|
}
|
|
34
65
|
end
|
|
35
66
|
|
|
67
|
+
--[=[
|
|
68
|
+
Creates a new weighted track.
|
|
69
|
+
|
|
70
|
+
@param track Track
|
|
71
|
+
@param weight number
|
|
72
|
+
@return WeightedTrack
|
|
73
|
+
]=]
|
|
36
74
|
function AnimationGroupUtils.createdWeightedTrack(track, weight)
|
|
37
75
|
assert(typeof(track) == "Instance" and track:IsA("AnimationTrack"), "Bad track")
|
|
38
76
|
assert(type(weight) == "number", "Bad weight")
|
|
@@ -43,6 +81,12 @@ function AnimationGroupUtils.createdWeightedTrack(track, weight)
|
|
|
43
81
|
}
|
|
44
82
|
end
|
|
45
83
|
|
|
84
|
+
--[=[
|
|
85
|
+
Picks a weighted track for playback.
|
|
86
|
+
|
|
87
|
+
@param weightedTracks { WeightedTrack }
|
|
88
|
+
@return WeightedTrack?
|
|
89
|
+
]=]
|
|
46
90
|
function AnimationGroupUtils.selectFromWeightedTracks(weightedTracks)
|
|
47
91
|
assert(type(weightedTracks) == "table", "Bad weightedTracks")
|
|
48
92
|
assert(#weightedTracks > 0, "Bad weightedTracks")
|