File size: 417 Bytes
2c3c408 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | from typing import NamedTuple
class Transition(NamedTuple):
duration: float = 1.0
easing: str = "linear"
delay: float = 0.0
def __str__(self) -> str:
duration, easing, delay = self
if delay:
return f"{duration:.1f}s {easing} {delay:.1f}"
elif easing != "linear":
return f"{duration:.1f}s {easing}"
else:
return f"{duration:.1f}s"
|