smoothiepy 0.0.2__py3-none-any.whl → 0.1.0__py3-none-any.whl
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.
- smoothiepy/__init__.py +0 -1
- smoothiepy/core.py +32 -0
- smoothiepy/filter/__init__.py +0 -0
- smoothiepy/filter/basefilter.py +122 -0
- smoothiepy/filter/filter1d.py +324 -0
- smoothiepy/filter/filter2d.py +41 -0
- smoothiepy/filter/filter2d_naive.py +266 -0
- smoothiepy/smoother/__init__.py +0 -0
- smoothiepy/smoother/builder.py +110 -0
- smoothiepy/smoother/smoother.py +200 -0
- smoothiepy-0.1.0.dist-info/METADATA +181 -0
- smoothiepy-0.1.0.dist-info/RECORD +15 -0
- {smoothiepy-0.0.2.dist-info → smoothiepy-0.1.0.dist-info}/WHEEL +1 -1
- smoothiepy-0.1.0.dist-info/entry_points.txt +4 -0
- smoothiepy-0.1.0.dist-info/licenses/LICENSE +674 -0
- smoothiepy/easing_functions.py +0 -231
- smoothiepy-0.0.2.dist-info/LICENSE +0 -21
- smoothiepy-0.0.2.dist-info/METADATA +0 -16
- smoothiepy-0.0.2.dist-info/RECORD +0 -6
smoothiepy/easing_functions.py
DELETED
@@ -1,231 +0,0 @@
|
|
1
|
-
import math
|
2
|
-
|
3
|
-
class EasingFunction:
|
4
|
-
def out(self, t, weight=1):
|
5
|
-
raise NotImplementedError
|
6
|
-
|
7
|
-
def in_(self, t, weight=1):
|
8
|
-
raise NotImplementedError
|
9
|
-
|
10
|
-
def in_out(self, t, weight=1):
|
11
|
-
raise NotImplementedError
|
12
|
-
|
13
|
-
def out_in(self, t, weight=1):
|
14
|
-
raise NotImplementedError
|
15
|
-
|
16
|
-
class Exponential(EasingFunction):
|
17
|
-
def in_(self, t, weight=1):
|
18
|
-
return weight * (0 if t == 0 else 2 ** (10 * (t - 1)))
|
19
|
-
|
20
|
-
def out(self, t, weight=1):
|
21
|
-
return weight * (1 if t == 1 else 1 - 2 ** (-10 * t))
|
22
|
-
|
23
|
-
def in_out(self, t, weight=1):
|
24
|
-
if t == 0 or t == 1:
|
25
|
-
return weight * t
|
26
|
-
t *= 2
|
27
|
-
if t < 1:
|
28
|
-
return weight * 0.5 * 2 ** (10 * (t - 1))
|
29
|
-
return weight * 0.5 * (2 - 2 ** (-10 * (t - 1)))
|
30
|
-
|
31
|
-
def out_in(self, t, weight=1):
|
32
|
-
if t < 0.5:
|
33
|
-
return weight * 0.5 * self.out(t * 2)
|
34
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
35
|
-
|
36
|
-
class Quad(EasingFunction):
|
37
|
-
def in_(self, t, weight=1):
|
38
|
-
return weight * (t * t)
|
39
|
-
|
40
|
-
def out(self, t, weight=1):
|
41
|
-
return weight * (1 - (1 - t) * (1 - t))
|
42
|
-
|
43
|
-
def in_out(self, t, weight=1):
|
44
|
-
return weight * ((t / 0.5) ** 2 if t < 0.5 else 1 - ((1 - t) * (1 - t)) * 0.5)
|
45
|
-
|
46
|
-
def out_in(self, t, weight=1):
|
47
|
-
return weight * (0.5 * (t / 0.5) ** 2 if t < 0.5 else 0.5 * (1 - ((1 - t) * (1 - t)) * 0.5))
|
48
|
-
|
49
|
-
class Back(EasingFunction):
|
50
|
-
def in_(self, t, weight=1):
|
51
|
-
c1 = 1.70158
|
52
|
-
c2 = c1 * 1.525
|
53
|
-
return weight * (t ** 2 * ((c2 + 1) * t - c2))
|
54
|
-
|
55
|
-
def out(self, t, weight=1):
|
56
|
-
c1 = 1.70158
|
57
|
-
c2 = c1 * 1.525
|
58
|
-
t -= 1
|
59
|
-
return weight * ((t ** 2) * ((c2 + 1) * t + c2) + 1)
|
60
|
-
|
61
|
-
def in_out(self, t, weight=1):
|
62
|
-
c1 = 1.70158
|
63
|
-
c2 = c1 * 1.525
|
64
|
-
t *= 2
|
65
|
-
if t < 1:
|
66
|
-
return weight * 0.5 * (t ** 2 * ((c2 + 1) * t - c2))
|
67
|
-
t -= 2
|
68
|
-
return weight * 0.5 * ((t ** 2 * ((c2 + 1) * t + c2)) + 2)
|
69
|
-
|
70
|
-
def out_in(self, t, weight=1):
|
71
|
-
if t < 0.5:
|
72
|
-
return weight * 0.5 * self.out(t * 2)
|
73
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
74
|
-
|
75
|
-
class Bounce(EasingFunction):
|
76
|
-
def out(self, t, weight=1):
|
77
|
-
n1 = 7.5625
|
78
|
-
d1 = 2.75
|
79
|
-
if t < 1 / d1:
|
80
|
-
return weight * n1 * t * t
|
81
|
-
elif t < 2 / d1:
|
82
|
-
t -= 1.5 / d1
|
83
|
-
return weight * n1 * (t * t + 0.75)
|
84
|
-
elif t < 2.5 / d1:
|
85
|
-
t -= 2.25 / d1
|
86
|
-
return weight * n1 * (t * t + 0.9375)
|
87
|
-
else:
|
88
|
-
t -= 2.625 / d1
|
89
|
-
return weight * n1 * (t * t + 0.984375)
|
90
|
-
|
91
|
-
def in_(self, t, weight=1):
|
92
|
-
return weight * (1 - self.out(1 - t))
|
93
|
-
|
94
|
-
def in_out(self, t, weight=1):
|
95
|
-
return weight * (0.5 * self.in_(t * 2) if t < 0.5 else 0.5 * self.out(t * 2 - 1) + 0.5)
|
96
|
-
|
97
|
-
def out_in(self, t, weight=1):
|
98
|
-
return weight * (0.5 * self.out(t * 2) if t < 0.5 else 0.5 * self.in_(t * 2 - 1) + 0.5)
|
99
|
-
|
100
|
-
class Elastic(EasingFunction):
|
101
|
-
def in_(self, t, weight=1):
|
102
|
-
if t == 0 or t == 1:
|
103
|
-
return weight * t
|
104
|
-
p = 0.3
|
105
|
-
s = p / 4
|
106
|
-
return weight * -(2 ** (10 * (t - 1))) * math.sin((t - s) * (2 * math.pi) / p)
|
107
|
-
|
108
|
-
def out(self, t, weight=1):
|
109
|
-
if t == 0 or t == 1:
|
110
|
-
return weight * t
|
111
|
-
p = 0.3
|
112
|
-
s = p / 4
|
113
|
-
return weight * ((2 ** (-10 * t)) * math.sin((t - s) * (2 * math.pi) / p) + 1)
|
114
|
-
|
115
|
-
def in_out(self, t, weight=1):
|
116
|
-
if t == 0 or t == 1:
|
117
|
-
return weight * t
|
118
|
-
t *= 2
|
119
|
-
p = 0.45
|
120
|
-
s = p / 4
|
121
|
-
if t < 1:
|
122
|
-
return weight * -0.5 * (2 ** (10 * (t - 1))) * math.sin((t - s) * (2 * math.pi) / p)
|
123
|
-
return weight * ((2 ** (-10 * (t - 1))) * math.sin((t - s) * (2 * math.pi) / p) * 0.5 + 1)
|
124
|
-
|
125
|
-
def out_in(self, t, weight=1):
|
126
|
-
if t < 0.5:
|
127
|
-
return weight * 0.5 * self.out(t * 2)
|
128
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
129
|
-
|
130
|
-
class Sine(EasingFunction):
|
131
|
-
def in_(self, t, weight=1):
|
132
|
-
return weight * (1 - math.cos((t * math.pi) / 2))
|
133
|
-
|
134
|
-
def out(self, t, weight=1):
|
135
|
-
return weight * math.sin((t * math.pi) / 2)
|
136
|
-
|
137
|
-
def in_out(self, t, weight=1):
|
138
|
-
return weight * 0.5 * (1 - math.cos(math.pi * t))
|
139
|
-
|
140
|
-
def out_in(self, t, weight=1):
|
141
|
-
if t < 0.5:
|
142
|
-
return weight * 0.5 * self.out(t * 2)
|
143
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
144
|
-
|
145
|
-
class Circ(EasingFunction):
|
146
|
-
def in_(self, t, weight=1):
|
147
|
-
return weight * (1 - math.sqrt(1 - (t ** 2)))
|
148
|
-
|
149
|
-
def out(self, t, weight=1):
|
150
|
-
t -= 1
|
151
|
-
return weight * math.sqrt(1 - (t ** 2))
|
152
|
-
|
153
|
-
def in_out(self, t, weight=1):
|
154
|
-
t *= 2
|
155
|
-
if t < 1:
|
156
|
-
return weight * 0.5 * (1 - math.sqrt(1 - (t ** 2)))
|
157
|
-
t -= 2
|
158
|
-
return weight * 0.5 * (math.sqrt(1 - (t ** 2)) + 1)
|
159
|
-
|
160
|
-
def out_in(self, t, weight=1):
|
161
|
-
if t < 0.5:
|
162
|
-
return weight * 0.5 * self.out(t * 2)
|
163
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
164
|
-
|
165
|
-
class Cubic(EasingFunction):
|
166
|
-
def in_(self, t, weight=1):
|
167
|
-
return weight * (t ** 3)
|
168
|
-
|
169
|
-
def out(self, t, weight=1):
|
170
|
-
t -= 1
|
171
|
-
return weight * ((t ** 3) + 1)
|
172
|
-
|
173
|
-
def in_out(self, t, weight=1):
|
174
|
-
t *= 2
|
175
|
-
if t < 1:
|
176
|
-
return weight * 0.5 * (t ** 3)
|
177
|
-
t -= 2
|
178
|
-
return weight * 0.5 * ((t ** 3) + 2)
|
179
|
-
|
180
|
-
def out_in(self, t, weight=1):
|
181
|
-
if t < 0.5:
|
182
|
-
return weight * 0.5 * self.out(t * 2)
|
183
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
184
|
-
|
185
|
-
class Quart(EasingFunction):
|
186
|
-
def in_(self, t, weight=1):
|
187
|
-
return weight * (t ** 4)
|
188
|
-
|
189
|
-
def out(self, t, weight=1):
|
190
|
-
t -= 1
|
191
|
-
return weight * ((t ** 4) + 1)
|
192
|
-
|
193
|
-
def in_out(self, t, weight=1):
|
194
|
-
t *= 2
|
195
|
-
if t < 1:
|
196
|
-
return weight * 0.5 * (t ** 4)
|
197
|
-
t -= 2
|
198
|
-
return weight * 0.5 * ((t ** 4) + 2)
|
199
|
-
|
200
|
-
def out_in(self, t, weight=1):
|
201
|
-
if t < 0.5:
|
202
|
-
return weight * 0.5 * self.out(t * 2)
|
203
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
204
|
-
|
205
|
-
class Quint(EasingFunction):
|
206
|
-
def in_(self, t, weight=1):
|
207
|
-
return weight * (t ** 5)
|
208
|
-
|
209
|
-
def out(self, t, weight=1):
|
210
|
-
t -= 1
|
211
|
-
return weight * ((t ** 5) + 1)
|
212
|
-
|
213
|
-
def in_out(self, t, weight=1):
|
214
|
-
t *= 2
|
215
|
-
if t < 1:
|
216
|
-
return weight * 0.5 * (t ** 5)
|
217
|
-
t -= 2
|
218
|
-
return weight * 0.5 * ((t ** 5) + 2)
|
219
|
-
|
220
|
-
def out_in(self, t, weight=1):
|
221
|
-
if t < 0.5:
|
222
|
-
return weight * 0.5 * self.out(t * 2)
|
223
|
-
return weight * (0.5 * self.in_(t * 2 - 1) + 0.5)
|
224
|
-
|
225
|
-
|
226
|
-
def mix_easing(t, *easing_funcs_and_weights):
|
227
|
-
total_weight = sum(weight for weight, _ in easing_funcs_and_weights)
|
228
|
-
result = 0
|
229
|
-
for weight, easing_func in easing_funcs_and_weights:
|
230
|
-
result += (weight / total_weight) * easing_func(t)
|
231
|
-
return result
|
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2024 Strimnik
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: smoothiepy
|
3
|
-
Version: 0.0.2
|
4
|
-
Summary: A library for various easing functions.
|
5
|
-
License: MIT
|
6
|
-
Author: Strimnik
|
7
|
-
Requires-Python: >=3.6
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
10
|
-
Classifier: Programming Language :: Python :: 3.6
|
11
|
-
Classifier: Programming Language :: Python :: 3.7
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
13
|
-
Classifier: Programming Language :: Python :: 3.9
|
14
|
-
Classifier: Programming Language :: Python :: 3.10
|
15
|
-
Classifier: Programming Language :: Python :: 3.11
|
16
|
-
Classifier: Programming Language :: Python :: 3.12
|
@@ -1,6 +0,0 @@
|
|
1
|
-
smoothiepy/__init__.py,sha256=t5OxxXYztyxrMV_xWan3GqQTtOQbzZHlUYrxa8rcAeg,48
|
2
|
-
smoothiepy/easing_functions.py,sha256=Y-IOjw9XNSSExkmiB9hIZWuKmMzedPtgJqlHHWclDLY,6992
|
3
|
-
smoothiepy-0.0.2.dist-info/LICENSE,sha256=g_THpn4YFNVZxdi4DZy1h-Jwpd-2EaKYVomsGeoWkMY,1084
|
4
|
-
smoothiepy-0.0.2.dist-info/METADATA,sha256=jOOx8BXRivBni0_Rd93N7f0HahPPHGVEHa9uUzkEdpU,608
|
5
|
-
smoothiepy-0.0.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
6
|
-
smoothiepy-0.0.2.dist-info/RECORD,,
|