File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -161,33 +161,31 @@ def smooth(t: float, inflection: float = 10.0) -> float:
161161 )
162162
163163
164+ @unit_interval
164165def smoothstep (t : float ) -> float :
165166 """Implementation of the 1st order SmoothStep sigmoid function.
166167 The 1st derivative (speed) is zero at the endpoints.
167168 https://en.wikipedia.org/wiki/Smoothstep
168169 """
169- return 0 if t <= 0 else 3 * t ** 2 - 2 * t ** 3 if t < 1 else 1
170+ return 3 * t ** 2 - 2 * t ** 3
170171
171172
173+ @unit_interval
172174def smootherstep (t : float ) -> float :
173175 """Implementation of the 2nd order SmoothStep sigmoid function.
174176 The 1st and 2nd derivatives (speed and acceleration) are zero at the endpoints.
175177 https://en.wikipedia.org/wiki/Smoothstep
176178 """
177- return 0 if t <= 0 else 6 * t ** 5 - 15 * t ** 4 + 10 * t ** 3 if t < 1 else 1
179+ return 6 * t ** 5 - 15 * t ** 4 + 10 * t ** 3
178180
179181
182+ @unit_interval
180183def smoothererstep (t : float ) -> float :
181184 """Implementation of the 3rd order SmoothStep sigmoid function.
182185 The 1st, 2nd and 3rd derivatives (speed, acceleration and jerk) are zero at the endpoints.
183186 https://en.wikipedia.org/wiki/Smoothstep
184187 """
185- alpha : float = 0
186- if 0 < t < 1 :
187- alpha = 35 * t ** 4 - 84 * t ** 5 + 70 * t ** 6 - 20 * t ** 7
188- elif t >= 1 :
189- alpha = 1
190- return alpha
188+ return 35 * t ** 4 - 84 * t ** 5 + 70 * t ** 6 - 20 * t ** 7
191189
192190
193191@unit_interval
You can’t perform that action at this time.
0 commit comments