Skip to content

Commit 0a28b79

Browse files
Implement initial logo generation
Signed-off-by: Jacob Stopak <jacob@initialcommit.io>
1 parent a45db4c commit 0a28b79

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed

git_sim/__main__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import git_sim.stash
2020
import git_sim.status
2121
import git_sim.tag
22+
import git_sim.logo
2223
from git_sim.settings import ImgFormat, VideoFormat, settings
2324
from manim import config, WHITE
2425

@@ -197,6 +198,7 @@ def main(
197198
app.command()(git_sim.stash.stash)
198199
app.command()(git_sim.status.status)
199200
app.command()(git_sim.tag.tag)
201+
app.command()(git_sim.logo.logo)
200202

201203

202204
if __name__ == "__main__":

git_sim/logo.py

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import typer
2+
3+
from git_sim.animations import handle_animations
4+
from git_sim.git_sim_base_command import GitSimBaseCommand
5+
from git_sim.settings import settings
6+
import numpy
7+
import manim as m
8+
import math
9+
10+
11+
class Logo(GitSimBaseCommand):
12+
def __init__(self):
13+
super().__init__()
14+
15+
def construct(self):
16+
print("Building logo...")
17+
self.draw_logo()
18+
self.recenter_frame()
19+
self.scale_frame()
20+
self.fadeout()
21+
22+
def draw_logo(self):
23+
circle1 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
24+
circle1.height = 0.25
25+
circle1.shift(m.RIGHT * 2 / 3)
26+
27+
circle2 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
28+
circle2.height = 0.25
29+
circle2.shift(m.UP * (1 / math.sqrt(3)))
30+
circle2.shift(m.LEFT / 3)
31+
32+
circle3 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
33+
circle3.height = 0.25
34+
circle3.shift(m.DOWN * (1 / math.sqrt(3)))
35+
circle3.shift(m.LEFT / 3)
36+
37+
title = m.Text(
38+
"git-sim",
39+
font="Monospace",
40+
font_size=12,
41+
color=m.BLUE,
42+
)
43+
44+
arc1 = m.Arc(
45+
radius=2 / 3,
46+
start_angle=m.PI / 14.5,
47+
angle=m.PI / 1.89,
48+
color=m.WHITE,
49+
stroke_width=1.5,
50+
tip_length=0.1,
51+
).add_tip()
52+
53+
arc2 = m.Arc(
54+
radius=2 / 3,
55+
start_angle=m.PI / 14.5 + 2 * m.PI / 3,
56+
angle=m.PI / 1.89,
57+
color=m.WHITE,
58+
stroke_width=1.5,
59+
tip_length=0.1,
60+
).add_tip()
61+
62+
arc3 = m.Arc(
63+
radius=2 / 3,
64+
start_angle=m.PI / 14.5 + 4 * m.PI / 3,
65+
angle=m.PI / 1.89,
66+
color=m.WHITE,
67+
stroke_width=1.5,
68+
tip_length=0.1,
69+
).add_tip()
70+
71+
circle4 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
72+
circle5 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
73+
circle6 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
74+
circle7 = m.Circle(stroke_color=m.RED, fill_color=m.RED, fill_opacity=0.25)
75+
circle4.height = 0.25
76+
circle5.height = 0.25
77+
circle6.height = 0.25
78+
circle7.height = 0.25
79+
80+
circle4.next_to(circle1, m.RIGHT * 1.25)
81+
circle5.next_to(circle4, m.RIGHT * 1.25)
82+
circle6.next_to(circle5, m.RIGHT * 1.25)
83+
circle7.next_to(circle6, m.RIGHT * 1.25)
84+
85+
arrow1 = m.Arrow(circle1.get_center(), m.RIGHT, color=m.WHITE, stroke_width=1.5)
86+
arrow1.set_length(0.275)
87+
arrow2 = m.Arrow(circle1.get_center(), m.RIGHT, color=m.WHITE, stroke_width=1.5)
88+
arrow2.set_length(0.275)
89+
arrow3 = m.Arrow(circle1.get_center(), m.RIGHT, color=m.WHITE, stroke_width=1.5)
90+
arrow3.set_length(0.275)
91+
arrow4 = m.Arrow(circle1.get_center(), m.RIGHT, color=m.WHITE, stroke_width=1.5)
92+
arrow4.set_length(0.275)
93+
94+
arrow1.next_to(circle1, m.RIGHT * 0.075)
95+
arrow2.next_to(circle4, m.RIGHT * 0.075)
96+
arrow3.next_to(circle5, m.RIGHT * 0.075)
97+
arrow4.next_to(circle6, m.RIGHT * 0.075)
98+
99+
message1 = m.Text("Visually", font="Monospace", font_size=6, color=m.WHITE)
100+
message2 = m.Text("simulate", font="Monospace", font_size=6, color=m.WHITE)
101+
message3 = m.Text("Git", font="Monospace", font_size=6, color=m.WHITE)
102+
message4 = m.Text("commands.", font="Monospace", font_size=6, color=m.WHITE)
103+
104+
message1.move_to((circle4.get_center()[0], circle4.get_center()[1] + 0.25, 0))
105+
message2.move_to((circle5.get_center()[0], circle5.get_center()[1] + 0.25, 0))
106+
message3.move_to((circle6.get_center()[0], circle6.get_center()[1] + 0.25, 0))
107+
message4.move_to((circle7.get_center()[0], circle7.get_center()[1] + 0.25, 0))
108+
109+
self.add(
110+
circle1,
111+
circle2,
112+
circle3,
113+
circle4,
114+
circle5,
115+
circle6,
116+
circle7,
117+
title,
118+
arc1,
119+
arc2,
120+
arc3,
121+
arrow1,
122+
arrow2,
123+
arrow3,
124+
arrow4,
125+
message1,
126+
message2,
127+
message3,
128+
message4,
129+
)
130+
131+
self.toFadeOut.add(
132+
circle1,
133+
circle2,
134+
circle3,
135+
circle4,
136+
circle5,
137+
circle6,
138+
circle7,
139+
title,
140+
arc1,
141+
arc2,
142+
arc3,
143+
arrow1,
144+
arrow2,
145+
arrow3,
146+
arrow4,
147+
message1,
148+
message2,
149+
message3,
150+
message4,
151+
)
152+
153+
154+
def logo():
155+
scene = Logo()
156+
handle_animations(scene=scene)

0 commit comments

Comments
 (0)