Exemple #1
0
 def get_easing(self) -> core.easingcurve.TypeStr | Callable[[float], float]:
     curve = core.EasingCurve(self.easingCurve())
     typ = curve.get_type()
     if typ == "custom":
         return curve.get_custom_type()
     else:
         return typ
Exemple #2
0
 def set_easing(
     self, easing_type: core.easingcurve.TypeStr | Callable[[float], float]
 ):
     curve = core.EasingCurve()
     if isinstance(easing_type, str):
         curve.set_type(easing_type)
     else:
         curve.set_custom_type(easing_type)
     self.setEasingCurve(curve)
Exemple #3
0
def test_easingcurve():
    c = core.EasingCurve()
    c.set_type("in_cubic")
    assert c.get_type() == "in_cubic"
    assert c[0] == 0
    assert c[1] == 1

    def custom(val):
        return 1

    c.set_custom_type(custom)
    assert c.get_custom_type() == custom
    assert c.get_type() == "custom"
    with pytest.raises(InvalidParamError):
        c.set_type("test")
Exemple #4
0
 def get_animation_easing_curve(self) -> core.EasingCurve:
     return core.EasingCurve(self.animationEasingCurve())