@quenty/flipbook 2.0.1 → 2.0.2
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
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.0.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/flipbook@2.0.1...@quenty/flipbook@2.0.2) (2023-03-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix flipbook playback on odd row/column scenarios ([fc60b33](https://github.com/Quenty/NevermoreEngine/commit/fc60b33bf451ac2d9cd0195ebd3a620d2f6c7907))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/flipbook@2.0.0...@quenty/flipbook@2.0.1) (2023-03-06)
|
|
7
18
|
|
|
8
19
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/flipbook",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Handles playing back animated spritesheets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "4af2ad938d63749844c14c9a6bf80a2804ae9b1d"
|
|
40
40
|
}
|
package/src/Client/Flipbook.lua
CHANGED
|
@@ -37,7 +37,7 @@ function Flipbook.new(data)
|
|
|
37
37
|
self:SetFrameCount(data.frameCount)
|
|
38
38
|
else
|
|
39
39
|
assert(data.columns, "Bad columns")
|
|
40
|
-
assert(data.
|
|
40
|
+
assert(data.rows, "Bad rows")
|
|
41
41
|
|
|
42
42
|
self:SetFrameCount(data.rows*data.columns)
|
|
43
43
|
end
|
|
@@ -48,10 +48,10 @@ function Flipbook.new(data)
|
|
|
48
48
|
|
|
49
49
|
do
|
|
50
50
|
local image = assert(data.image, "Bad image")
|
|
51
|
-
local
|
|
51
|
+
local columns = assert(data.columns, "Bad columns")
|
|
52
52
|
local imageRectSize = assert(data.imageRectSize, "Bad imageRectSize")
|
|
53
53
|
|
|
54
|
-
self:_loadFrames(image,
|
|
54
|
+
self:_loadFrames(image, columns, imageRectSize)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
return self
|
|
@@ -61,15 +61,15 @@ function Flipbook.isFlipbook(value)
|
|
|
61
61
|
return type(value) == "table" and getmetatable(value) == Flipbook
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
function Flipbook:_loadFrames(image,
|
|
65
|
-
assert(type(
|
|
64
|
+
function Flipbook:_loadFrames(image, columns, imageRectSize)
|
|
65
|
+
assert(type(columns) == "number", "Bad columns")
|
|
66
66
|
assert(typeof(imageRectSize) == "Vector2", "Bad imageRectSize")
|
|
67
67
|
|
|
68
68
|
self:SetImageRectSize(imageRectSize)
|
|
69
69
|
|
|
70
70
|
for i=0, self._frameCount do
|
|
71
|
-
local x = i %
|
|
72
|
-
local y = math.floor(i /
|
|
71
|
+
local x = i % columns
|
|
72
|
+
local y = math.floor(i / columns)
|
|
73
73
|
local position = imageRectSize*Vector2.new(x, y)
|
|
74
74
|
|
|
75
75
|
local index = i + 1
|
|
@@ -111,19 +111,21 @@ return function(target)
|
|
|
111
111
|
|
|
112
112
|
makeLabel(maid, Flipbook.new({
|
|
113
113
|
image = "rbxassetid://9234616869";
|
|
114
|
-
rows =
|
|
115
|
-
columns =
|
|
114
|
+
rows = 10;
|
|
115
|
+
columns = 10;
|
|
116
|
+
frameCount = 92;
|
|
116
117
|
imageRectSize = Vector2.new(102, 102);
|
|
117
118
|
frameRate = 50;
|
|
118
|
-
}), container,
|
|
119
|
+
}), container, false)
|
|
119
120
|
|
|
120
121
|
makeButton(maid, Flipbook.new({
|
|
121
122
|
image = "rbxassetid://9234616869";
|
|
122
|
-
rows =
|
|
123
|
-
columns =
|
|
123
|
+
rows = 10;
|
|
124
|
+
columns = 10;
|
|
125
|
+
frameCount = 92;
|
|
124
126
|
imageRectSize = Vector2.new(102, 102);
|
|
125
127
|
frameRate = 60;
|
|
126
|
-
}), container,
|
|
128
|
+
}), container, false)
|
|
127
129
|
|
|
128
130
|
makeButton(maid, Flipbook.new({
|
|
129
131
|
image = "rbxassetid://5085366281";
|
|
@@ -134,6 +136,33 @@ return function(target)
|
|
|
134
136
|
frameRate = 20;
|
|
135
137
|
}), container, true)
|
|
136
138
|
|
|
139
|
+
makeLabel(maid, Flipbook.new({
|
|
140
|
+
image = "rbxassetid://9234616869";
|
|
141
|
+
rows = 10;
|
|
142
|
+
columns = 10;
|
|
143
|
+
frameCount = 92;
|
|
144
|
+
imageRectSize = Vector2.new(102, 102);
|
|
145
|
+
frameRate = 50;
|
|
146
|
+
}), container, false)
|
|
147
|
+
|
|
148
|
+
makeLabel(maid, Flipbook.new({
|
|
149
|
+
image = "rbxassetid://12273540121";
|
|
150
|
+
rows = 7;
|
|
151
|
+
columns = 7;
|
|
152
|
+
frameCount = 45;
|
|
153
|
+
imageRectSize = Vector2.new(146, 146);
|
|
154
|
+
frameRate = 30;
|
|
155
|
+
}), container, false)
|
|
156
|
+
|
|
157
|
+
makeLabel(maid, Flipbook.new({
|
|
158
|
+
image = "rbxassetid://9234650028";
|
|
159
|
+
columns = 9;
|
|
160
|
+
rows = 8;
|
|
161
|
+
frameCount = 66;
|
|
162
|
+
imageRectSize = Vector2.new(113, 113);
|
|
163
|
+
frameRate = 60;
|
|
164
|
+
}), container, false)
|
|
165
|
+
|
|
137
166
|
return function()
|
|
138
167
|
maid:DoCleaning()
|
|
139
168
|
end
|