@@ -482,10 +482,25 @@ def __init__(self):
482482 )
483483 v3 .VDivider (vertical = True , classes = "mx-2" )
484484 v3 .VIconBtn (
485- icon = ("animation_play ? 'mdi-stop' : 'mdi-play'" ,),
485+ icon = (
486+ "animation_play && animation_direction === 'reverse' ? 'mdi-stop' : 'mdi-play'" ,
487+ ),
486488 flat = True ,
487- click = "animation_play = !animation_play" ,
488- disabled = ("capture_recording" ,),
489+ click = "if (animation_play && animation_direction === 'reverse') { animation_play = false } else { animation_direction = 'reverse'; animation_play = true }" ,
490+ disabled = (
491+ "capture_recording || (animation_play && animation_direction === 'forward')" ,
492+ ),
493+ style = "transform: scaleX(-1);" ,
494+ )
495+ v3 .VIconBtn (
496+ icon = (
497+ "animation_play && animation_direction === 'forward' ? 'mdi-stop' : 'mdi-play'" ,
498+ ),
499+ flat = True ,
500+ click = "if (animation_play && animation_direction === 'forward') { animation_play = false } else { animation_direction = 'forward'; animation_play = true }" ,
501+ disabled = (
502+ "capture_recording || (animation_play && animation_direction === 'reverse')" ,
503+ ),
489504 )
490505 v3 .VDivider (vertical = True , classes = "mx-2" )
491506
@@ -572,7 +587,13 @@ async def _run_animation(self):
572587 with self .state as s :
573588 while s .animation_play :
574589 await asyncio .sleep (0.1 )
575- if s .animation_step < s .animation_step_max :
576- await self ._step_to (s .animation_step + 1 )
590+ if s .animation_direction == "reverse" :
591+ if s .animation_step > 0 :
592+ await self ._step_to (s .animation_step - 1 )
593+ else :
594+ await self ._step_to (s .animation_step_max )
577595 else :
578- s .animation_play = False
596+ if s .animation_step < s .animation_step_max :
597+ await self ._step_to (s .animation_step + 1 )
598+ else :
599+ await self ._step_to (0 )
0 commit comments