@quenty/rotatinglabel 11.8.1 → 11.8.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
|
+
## [11.8.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rotatinglabel@11.8.1...@quenty/rotatinglabel@11.8.2) (2025-04-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [11.8.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/rotatinglabel@11.8.0...@quenty/rotatinglabel@11.8.1) (2025-03-21)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/rotatinglabel
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/rotatinglabel",
|
|
3
|
-
"version": "11.8.
|
|
3
|
+
"version": "11.8.2",
|
|
4
4
|
"description": "A text label with most general properties of a textlabel, except when text is set, it rotates uniformly like an old clock, animating in a satisfying way",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "^10.8.
|
|
29
|
-
"@quenty/math": "^2.7.
|
|
30
|
-
"@quenty/spring": "^10.8.
|
|
28
|
+
"@quenty/loader": "^10.8.1",
|
|
29
|
+
"@quenty/math": "^2.7.2",
|
|
30
|
+
"@quenty/spring": "^10.8.2"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
|
|
36
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!nocheck
|
|
1
2
|
--[=[
|
|
2
3
|
Character that rotates for animations
|
|
3
4
|
@class RotatingCharacter
|
|
@@ -16,12 +17,12 @@ RotatingCharacter._transparency = 0
|
|
|
16
17
|
-- The key to use (ASCII) that acts as a space. So we get animations that move to this as a hidden value.
|
|
17
18
|
local SPACE_CODE = 96
|
|
18
19
|
local SPRING_VALUES = {
|
|
19
|
-
Target = true
|
|
20
|
-
Velocity = true
|
|
21
|
-
Speed = true
|
|
22
|
-
Position = true
|
|
23
|
-
Value = true
|
|
24
|
-
Damper = true
|
|
20
|
+
Target = true,
|
|
21
|
+
Velocity = true,
|
|
22
|
+
Speed = true,
|
|
23
|
+
Position = true,
|
|
24
|
+
Value = true,
|
|
25
|
+
Damper = true,
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function RotatingCharacter.new(Gui)
|
|
@@ -42,13 +43,13 @@ function RotatingCharacter.new(Gui)
|
|
|
42
43
|
self.TransparencyList = setmetatable({}, {
|
|
43
44
|
__newindex = function(transparencyList, index, value)
|
|
44
45
|
rawset(transparencyList, index, {
|
|
45
|
-
Gui = value
|
|
46
|
+
Gui = value,
|
|
46
47
|
Default = {
|
|
47
|
-
TextTransparency = value.TextTransparency
|
|
48
|
-
TextStrokeTransparency = value.TextStrokeTransparency
|
|
49
|
-
}
|
|
48
|
+
TextTransparency = value.TextTransparency,
|
|
49
|
+
TextStrokeTransparency = value.TextStrokeTransparency,
|
|
50
|
+
},
|
|
50
51
|
})
|
|
51
|
-
end
|
|
52
|
+
end,
|
|
52
53
|
})
|
|
53
54
|
self.TransparencyList[1] = self._label
|
|
54
55
|
self.TransparencyList[2] = self._labelTwo
|
|
@@ -63,7 +64,7 @@ function RotatingCharacter:__index(index)
|
|
|
63
64
|
elseif index == "IsDoneAnimating" then
|
|
64
65
|
return not SpringUtils.animating(self._spring)
|
|
65
66
|
elseif index == "NextCharacter" then
|
|
66
|
-
return self:_intToChar(self.Value+1) -- For rendering purposes.
|
|
67
|
+
return self:_intToChar(self.Value + 1) -- For rendering purposes.
|
|
67
68
|
elseif index == "Position" then
|
|
68
69
|
local _, position = SpringUtils.animating(self._spring)
|
|
69
70
|
return position
|
|
@@ -77,13 +78,13 @@ function RotatingCharacter:__index(index)
|
|
|
77
78
|
local default = (self.Position % 1)
|
|
78
79
|
|
|
79
80
|
-- Adjust transparency upwards based upon velocity
|
|
80
|
-
default = Math.map(default, 0, 1, math.clamp(math.abs(self.Velocity*2/self.Speed), 0, 0.25), 1)
|
|
81
|
+
default = Math.map(default, 0, 1, math.clamp(math.abs(self.Velocity * 2 / self.Speed), 0, 0.25), 1)
|
|
81
82
|
|
|
82
83
|
local transparency = self.Transparency
|
|
83
84
|
|
|
84
85
|
return {
|
|
85
|
-
[self._label] = Math.map(default, 0, 1, transparency, 1)
|
|
86
|
-
[self._labelTwo] = Math.map(default, 1, 0, transparency, 1)
|
|
86
|
+
[self._label] = Math.map(default, 0, 1, transparency, 1),
|
|
87
|
+
[self._labelTwo] = Math.map(default, 1, 0, transparency, 1),
|
|
87
88
|
}
|
|
88
89
|
else
|
|
89
90
|
return RotatingCharacter[index]
|
|
@@ -108,9 +109,9 @@ function RotatingCharacter:__newindex(index, value)
|
|
|
108
109
|
|
|
109
110
|
local transparencyMap = self.TransparencyMap
|
|
110
111
|
|
|
111
|
-
for _, data in
|
|
112
|
-
local transparency = transparencyMap[data.Gui] or error("Gui not in transparency map")
|
|
113
|
-
for property, propValue in
|
|
112
|
+
for _, data in self.TransparencyList do
|
|
113
|
+
local transparency = transparencyMap[data.Gui] or error("Gui not in transparency map")
|
|
114
|
+
for property, propValue in data.Default do
|
|
114
115
|
data.Gui[property] = Math.map(transparency, 0, 1, propValue, 1)
|
|
115
116
|
end
|
|
116
117
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!nocheck
|
|
1
2
|
--[=[
|
|
2
3
|
@class RotatingCharacterBuilder
|
|
3
4
|
]=]
|
|
@@ -26,7 +27,7 @@ function RotatingCharacterBuilder:Generate(Parent)
|
|
|
26
27
|
local Template = self.TextLabelTemplate or error("Must set TextLabelTemplate")
|
|
27
28
|
|
|
28
29
|
local container = Instance.new("Frame")
|
|
29
|
-
container.Name = "RotatingCharacterContainer"
|
|
30
|
+
container.Name = "RotatingCharacterContainer"
|
|
30
31
|
container.ClipsDescendants = true
|
|
31
32
|
container.SizeConstraint = Enum.SizeConstraint.RelativeYY
|
|
32
33
|
container.Size = UDim2.new(1, 0, 1, 0)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!nocheck
|
|
1
2
|
--[=[
|
|
2
3
|
A text label with most general properties of a textlabel, except when text is set,
|
|
3
4
|
it rotates uniformly like an old clock, animating in a satisfying way
|
|
@@ -54,22 +55,22 @@ function RotatingLabel.new()
|
|
|
54
55
|
|
|
55
56
|
newLabel.Gui.Position = self:_getLabelPosition(index)
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
end
|
|
58
|
+
for _, propertyName in { "Transparency", "Damper", "Speed" } do
|
|
59
|
+
if newLabel[propertyName] ~= self[propertyName] then
|
|
60
|
+
newLabel[propertyName] = self[propertyName]
|
|
61
61
|
end
|
|
62
|
+
end
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
rawset(labels, index, newLabel)
|
|
65
|
+
return newLabel
|
|
65
66
|
end
|
|
66
67
|
end
|
|
67
68
|
else
|
|
68
|
-
|
|
69
|
+
return rawget(labels, labelsIndex)
|
|
69
70
|
-- error(index .. " is not a valid member")
|
|
70
71
|
end
|
|
71
|
-
end
|
|
72
|
-
})
|
|
72
|
+
end,
|
|
73
|
+
})
|
|
73
74
|
|
|
74
75
|
self._bindKey = "RotatingLabel" .. tostring(self)
|
|
75
76
|
|
|
@@ -78,9 +79,9 @@ end
|
|
|
78
79
|
|
|
79
80
|
function RotatingLabel:_getLabelPosition(index)
|
|
80
81
|
if self.TextXAlignment == "Left" then
|
|
81
|
-
return UDim2.new((index-1)*self.Width, 0, 0, 0)
|
|
82
|
+
return UDim2.new((index - 1) * self.Width, 0, 0, 0)
|
|
82
83
|
else
|
|
83
|
-
return UDim2.new(-self.TotalWidth + (index-1)*self.Width, 0, 0, 0)
|
|
84
|
+
return UDim2.new(-self.TotalWidth + (index - 1) * self.Width, 0, 0, 0)
|
|
84
85
|
end
|
|
85
86
|
end
|
|
86
87
|
|
|
@@ -153,8 +154,8 @@ function RotatingLabel:__newindex(topindex, value)
|
|
|
153
154
|
|
|
154
155
|
local labels = {}
|
|
155
156
|
|
|
156
|
-
for index, label in
|
|
157
|
-
local NewIndex = index+Delta
|
|
157
|
+
for index, label in self._labels do
|
|
158
|
+
local NewIndex = index + Delta
|
|
158
159
|
labels[NewIndex] = label
|
|
159
160
|
|
|
160
161
|
-- Clean up
|
|
@@ -165,13 +166,13 @@ function RotatingLabel:__newindex(topindex, value)
|
|
|
165
166
|
self._labels[index] = nil
|
|
166
167
|
end
|
|
167
168
|
|
|
168
|
-
for index, label in
|
|
169
|
+
for index, label in labels do
|
|
169
170
|
self._labels[index] = label
|
|
170
171
|
end
|
|
171
172
|
else
|
|
172
173
|
-- Clean up past characters
|
|
173
174
|
|
|
174
|
-
for index = #value+1, #self.Text do
|
|
175
|
+
for index = #value + 1, #self.Text do
|
|
175
176
|
if self._labels[index] then
|
|
176
177
|
self._labels[index].TargetCharacter = " "
|
|
177
178
|
end
|
|
@@ -184,7 +185,7 @@ function RotatingLabel:__newindex(topindex, value)
|
|
|
184
185
|
self._labels:Get(index).TargetCharacter = string.sub(self.Text, index, index)
|
|
185
186
|
end
|
|
186
187
|
|
|
187
|
-
for index, label in
|
|
188
|
+
for index, label in self._labels do
|
|
188
189
|
label.Gui.Position = self:_getLabelPosition(index)
|
|
189
190
|
end
|
|
190
191
|
|
|
@@ -192,16 +193,16 @@ function RotatingLabel:__newindex(topindex, value)
|
|
|
192
193
|
elseif topindex == "Width" then
|
|
193
194
|
self._width = value
|
|
194
195
|
|
|
195
|
-
for index, label in
|
|
196
|
+
for index, label in self._labels do
|
|
196
197
|
label.Gui.Position = self:_getLabelPosition(index)
|
|
197
198
|
end
|
|
198
199
|
elseif topindex == "Transparency" or topindex == "Damper" or topindex == "Speed" then
|
|
199
200
|
self["_" .. string.lower(topindex)] = value
|
|
200
|
-
for _, label in
|
|
201
|
+
for _, label in self._labels do
|
|
201
202
|
label[topindex] = value
|
|
202
203
|
end
|
|
203
204
|
elseif topindex == "TextXAlignment" then
|
|
204
|
-
assert(value == "Left" or value == "Right",
|
|
205
|
+
assert(value == "Left" or value == "Right", 'value must be "Left" or "Right"')
|
|
205
206
|
|
|
206
207
|
if value == "Left" then
|
|
207
208
|
self._container.Position = UDim2.new(0, 0, 0, 0)
|
|
@@ -210,7 +211,7 @@ function RotatingLabel:__newindex(topindex, value)
|
|
|
210
211
|
end
|
|
211
212
|
|
|
212
213
|
self._textXAlignment = value
|
|
213
|
-
for index, label in
|
|
214
|
+
for index, label in self._labels do
|
|
214
215
|
label.Gui.Position = self:_getLabelPosition(index)
|
|
215
216
|
end
|
|
216
217
|
else
|
|
@@ -222,7 +223,7 @@ end
|
|
|
222
223
|
function RotatingLabel:UpdateRender()
|
|
223
224
|
local isDone = true
|
|
224
225
|
|
|
225
|
-
for index, label in
|
|
226
|
+
for index, label in self._labels do
|
|
226
227
|
if label:UpdateRender() then
|
|
227
228
|
if label.TargetCharacter == " " then
|
|
228
229
|
self._labels:Remove(index)
|
|
@@ -259,7 +260,7 @@ function RotatingLabel:Destroy()
|
|
|
259
260
|
self:_stopUpdate()
|
|
260
261
|
self._bindKey = nil
|
|
261
262
|
|
|
262
|
-
for index, _ in
|
|
263
|
+
for index, _ in self._labels do
|
|
263
264
|
self._labels:Remove(index)
|
|
264
265
|
end
|
|
265
266
|
self._labels = nil
|