feat(src/shared/widgets):add bezier_curve property and trigger animation on active
This commit is contained in:
2 files changed
+15
No files matched your search
@@ -84,6 +84,18 @@ class Animator(Service):
|
||||
@Signal
|
||||
def finished(self) -> None: ...
|
||||
|
||||
@Property(tuple[float, float, float, float], "read-write")
|
||||
def bezier_curve(self) -> tuple[float, float, float, float]:
|
||||
return self._bezier_curve
|
||||
|
||||
@bezier_curve.setter
|
||||
def bezier_curve(self, value: tuple[float, float, float, float]):
|
||||
self._bezier_curve = value
|
||||
self._timing_function = lambda progress=0.0, **_: cubic_bezier(
|
||||
*value, progress=progress
|
||||
)
|
||||
return
|
||||
|
||||
@Property(TimingFunctionCallback, "read-write")
|
||||
def timing_function(self) -> TimingFunctionCallback:
|
||||
return self._timing_function
|
||||
|
||||
@@ -55,6 +55,9 @@ class SmoothSwitch(Gtk.DrawingArea):
|
||||
max_value=1.0,
|
||||
tick_widget=self,
|
||||
)
|
||||
if active:
|
||||
self._animator.value = 1.0
|
||||
|
||||
self._animator.connect("notify::value", lambda *_: self.queue_draw())
|
||||
|
||||
self.add_events(
|
||||
|
||||
Reference in new issue
Block a user