Skip to content

Commit

Permalink
Fix doc strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
HeaTTheatR committed May 17, 2024
1 parent 0c6e79e commit ff8f818
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions kivymd/uix/transition/transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,18 @@ def on_progress(self, progression: float) -> None:


class MDSharedAxisTransition(MDTransitionBase):
"""Android default screen transition"""
"""
Android default screen transition.
.. versionadded:: 2.0.0
"""

transition_axis = OptionProperty("x", options=["x", "y", "z"])
"""
Axis of the transition. Available values "x", "y", and "z".
.. image:: https://github.com/kivymd/KivyMD/assets/68729523/063e478c-9e23-40d4-a8ce-4663b428b575
:height: 350px
:align: left
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/transition_axis.gif
:align: center
:attr:`transition_axis` is an :class:`~kivy.properties.OptionProperty`
and defaults to `"x"`.
Expand Down Expand Up @@ -388,7 +391,7 @@ def start(self, manager):

if self.transition_axis == "z":
if self.ih not in self._s_map.keys():
# Save scale instructions
# Save scale instructions.
with self.screen_in.canvas.before:
PushMatrix()
self._s_map[self.ih] = Scale()
Expand All @@ -405,25 +408,25 @@ def start(self, manager):
(manager.pos[1] + manager.height) / 2,
]
self._s_map[self.ih].origin = self._s_map[self.oh].origin
# relative subtracted area
# Relative subtracted area.
self._slide_diff = (manager.width - self.slide_distance) * (
manager.height - self.slide_distance
) / (manager.width * manager.height) - 1
elif self.transition_axis in ["x", "y"]:
# slide distance with opposite logic
# Slide distance with opposite logic.
self._slide_diff = (
(1 if self.opposite else -1) * self.slide_distance * 2
)
super().start(manager)

def on_progress(self, progress):
# This code could be simplyfied with setattr, but it's slow
# This code could be simplyfied with setattr, but it's slow.
progress = AnimationTransition.out_cubic(progress)
progress_i = progress - 1
progress_d = progress * 2
# first half
# First half.
if progress <= 0.5:
# Screen out animation
# Screen out animation.
if self.transition_axis == "z":
self._s_map[self.oh].xyz = (
*[1 + self._slide_diff * progress_d] * 2,
Expand All @@ -441,7 +444,7 @@ def on_progress(self, progress):
]
self.screen_out.opacity = 1 - progress_d
self.screen_in.opacity = 0
# second half
# Second half.
else:
if self.transition_axis == "z":
self._s_map[self.ih].xyz = (
Expand Down

0 comments on commit ff8f818

Please sign in to comment.