Method: rich.progress_bar.ProgressBar._render_pulse
Calls: 3, Exceptions: 0, Paths: 1Back
Path 1: 3 calls (1.0)
Console (3)
10 (2) 100 (1)
False (3)
Segment (120) None (3)
1def _render_pulse(
2 self, console: Console, width: int, ascii: bool = False
3 ) -> Iterable[Segment]:
4 """Renders the pulse animation.
5
6 Args:
7 console (Console): Console instance.
8 width (int): Width in characters of pulse animation.
9
10 Returns:
11 RenderResult: [description]
12
13 Yields:
14 Iterator[Segment]: Segments to render pulse
15 """
16 fore_style = console.get_style(self.pulse_style, default="white")
17 back_style = console.get_style(self.style, default="black")
18
19 pulse_segments = self._get_pulse_segments(
20 fore_style, back_style, console.color_system, console.no_color, ascii=ascii
21 )
22 segment_count = len(pulse_segments)
23 current_time = (
24 monotonic() if self.animation_time is None else self.animation_time
25 )
26 segments = pulse_segments * (int(width / segment_count) + 2)
27 offset = int(-current_time * 15) % segment_count
28 segments = segments[offset : offset + width]
29 yield from segments