Renders the pulse animation. Args: console (Console): Console instance. width (int): Width in characters of pulse animation. Returns: RenderResult: [description] Yields: Iterator[Segment]: Segments to render pulse
(
self, console: Console, width: int, ascii: bool = False
)
| 124 | self.total = total if total is not None else self.total |
| 125 | |
| 126 | def _render_pulse( |
| 127 | self, console: Console, width: int, ascii: bool = False |
| 128 | ) -> Iterable[Segment]: |
| 129 | """Renders the pulse animation. |
| 130 | |
| 131 | Args: |
| 132 | console (Console): Console instance. |
| 133 | width (int): Width in characters of pulse animation. |
| 134 | |
| 135 | Returns: |
| 136 | RenderResult: [description] |
| 137 | |
| 138 | Yields: |
| 139 | Iterator[Segment]: Segments to render pulse |
| 140 | """ |
| 141 | fore_style = console.get_style(self.pulse_style, default="white") |
| 142 | back_style = console.get_style(self.style, default="black") |
| 143 | |
| 144 | pulse_segments = self._get_pulse_segments( |
| 145 | fore_style, back_style, console.color_system, console.no_color, ascii=ascii |
| 146 | ) |
| 147 | segment_count = len(pulse_segments) |
| 148 | current_time = ( |
| 149 | monotonic() if self.animation_time is None else self.animation_time |
| 150 | ) |
| 151 | segments = pulse_segments * (int(width / segment_count) + 2) |
| 152 | offset = int(-current_time * 15) % segment_count |
| 153 | segments = segments[offset : offset + width] |
| 154 | yield from segments |
| 155 | |
| 156 | def __rich_console__( |
| 157 | self, console: Console, options: ConsoleOptions |
no test coverage detected