-
-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathbranch.py
More file actions
54 lines (43 loc) · 1.49 KB
/
branch.py
File metadata and controls
54 lines (43 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import manim as m
from git_sim.git_sim_base_command import GitSimBaseCommand
from git_sim.settings import settings
class Branch(GitSimBaseCommand):
def __init__(self, name: str):
super().__init__()
self.name = name
self.cmd += f"{type(self).__name__.lower()} {self.name}"
def construct(self):
if not settings.stdout and not settings.output_only_path and not settings.quiet:
print(f"{settings.INFO_STRING} {self.cmd}")
self.show_intro()
self.parse_commits()
self.parse_all()
self.center_frame_on_commit(self.get_commit())
branchText = m.Text(
self.name,
font=self.font,
font_size=20,
color=self.fontColor,
)
branchRec = m.Rectangle(
color=m.GREEN,
fill_color=m.GREEN,
fill_opacity=0.25,
height=0.4,
width=branchText.width + 0.25,
)
branchRec.next_to(self.topref, m.UP)
branchText.move_to(branchRec.get_center())
fullbranch = m.VGroup(branchRec, branchText)
if settings.animate:
self.play(m.Create(fullbranch), run_time=1 / settings.speed)
else:
self.add(fullbranch)
self.toFadeOut.add(branchRec, branchText)
self.drawnRefs[self.name] = fullbranch
self.recenter_frame()
self.scale_frame()
self.color_by()
self.show_command_as_title()
self.fadeout()
self.show_outro()