File tree 1 file changed +6
-8
lines changed
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:
161
161
)
162
162
163
163
164
+ @unit_interval
164
165
def smoothstep (t : float ) -> float :
165
166
"""Implementation of the 1st order SmoothStep sigmoid function.
166
167
The 1st derivative (speed) is zero at the endpoints.
167
168
https://en.wikipedia.org/wiki/Smoothstep
168
169
"""
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
170
171
171
172
173
+ @unit_interval
172
174
def smootherstep (t : float ) -> float :
173
175
"""Implementation of the 2nd order SmoothStep sigmoid function.
174
176
The 1st and 2nd derivatives (speed and acceleration) are zero at the endpoints.
175
177
https://en.wikipedia.org/wiki/Smoothstep
176
178
"""
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
178
180
179
181
182
+ @unit_interval
180
183
def smoothererstep (t : float ) -> float :
181
184
"""Implementation of the 3rd order SmoothStep sigmoid function.
182
185
The 1st, 2nd and 3rd derivatives (speed, acceleration and jerk) are zero at the endpoints.
183
186
https://en.wikipedia.org/wiki/Smoothstep
184
187
"""
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
191
189
192
190
193
191
@unit_interval
You can’t perform that action at this time.
0 commit comments