Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aannleax committed Aug 18, 2024
0 parents commit 158fc82
Show file tree
Hide file tree
Showing 16 changed files with 566 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__pycache__
media
slides
Slides_assets
slides.pdf
Binary file added images/announcement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/channel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/summer_videos.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/title.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions scenes/animation_a.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from manim import *
from manim_slides import Slide

from util import text, coordinates

class AnimationA(Slide):
def __init__(self):
super().__init__()
self.title = "Example (1)"
self.triangle_color = BLUE

def construct(self, render):
du = 0.2 * DOWN
d1 = Dot(LEFT*4+du)
d2 = Dot(RIGHT*2+du)
d3 = Dot(RIGHT*1+UP*3+du)

triangle = Polygon(
d1.get_center(),d2.get_center(),d3.get_center(),
color = self.triangle_color,
stroke_width = 8
)
render.add(triangle)

alpha_arc = Angle.from_three_points(d2,d1,d3, color=self.triangle_color)
beta_arc = Angle.from_three_points(d3,d2,d1, color=self.triangle_color)
gamma_arc = Angle.from_three_points(d1,d3,d2, color=self.triangle_color)

render.add(alpha_arc)
render.add(beta_arc)
render.add(gamma_arc)

alpha = text.math(r"\alpha").next_to(d1).shift(0.3*RIGHT+0.2*UP)
beta = text.math(r"\beta").next_to(d2, UP).shift(0.4*LEFT)
gamma = text.math(r"\gamma").next_to(d3, DOWN).shift(0.2*DOWN+0.2*LEFT)
angles = VGroup(alpha, beta, gamma)

render.add(alpha)
render.add(beta)
render.add(gamma)

render.wait()
render.next_slide()

equation_1 = text.math(r"\alpha").move_to(2 * DOWN)
equation_2 = text.math(r"\alpha", " + ", r"\beta").move_to(2 * DOWN)
equation_3 = text.math(r"\alpha", " + ", r"\beta", " + ", r"\gamma").move_to(2 * DOWN)
equation_4 = text.math(r"\alpha", " + ", r"\beta", " + ", r"\gamma", r" = 180^\circ").move_to(2 * DOWN)

render.play(TransformMatchingTex(alpha.copy(), equation_1))
render.wait()
render.play(TransformMatchingTex(Group(equation_1, beta.copy()), equation_2))
render.wait()
render.play(TransformMatchingTex(Group(equation_2, gamma.copy()), equation_3))
render.wait()
render.play(TransformMatchingTex(equation_3, equation_4))

render.wait()
19 changes: 19 additions & 0 deletions scenes/animation_b.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from manim import *
from manim_slides import Slide

from util import text, coordinates

class Example(Slide):
def __init__(self):
super().__init__()
self.title = "Example"


def construct(self, render):
my_text = text.tex("Test").next_to(coordinates.UPPER_LEFT)
render.add(my_text)

circle = Circle(radius=2, color=BLUE)
render.add(circle)

render.wait()
28 changes: 28 additions & 0 deletions scenes/community.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from manim import *
from manim_slides import Slide

from util import text, coordinates

class Community(Slide):
def __init__(self):
super().__init__()
self.title = "The Manim Community"


def construct(self, render):
exposition = ImageMobject(
"images/announcement.png"
).scale_to_fit_width(
0.4 * render.camera.frame_width
).next_to(ORIGIN, LEFT)

participants = ImageMobject(
"images/summer_videos.jpg"
).scale_to_fit_width(
0.4 * render.camera.frame_width
).next_to(ORIGIN, RIGHT)

render.add(exposition)
render.add(participants)

render.wait()
19 changes: 19 additions & 0 deletions scenes/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from manim import *
from manim_slides import Slide

from util import text, coordinates

class Example(Slide):
def __init__(self):
super().__init__()
self.title = "Example"


def construct(self, render):
my_text = text.tex("Test").next_to(coordinates.UPPER_LEFT)
render.add(my_text)

circle = Circle(radius=2, color=BLUE)
render.add(circle)

render.wait()
37 changes: 37 additions & 0 deletions scenes/title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from dataclasses import dataclass

from manim import *
from manim_slides import Slide

from util import text

@dataclass
class Title(Slide):
title: str
authors: str
affiliation: str
date: str

def construct(self, render):
background = ImageMobject("images/title.png")
background.scale_to_fit_height(render.camera.frame_height)
background.scale_to_fit_width(render.camera.frame_width)
render.add(background)

coordinate_start = 6 * LEFT + 1 * UP

text_authors = text.tex(self.authors, color = WHITE, font_size=24).next_to(coordinate_start, RIGHT)
text_affiliation = text.tex(self.affiliation, color = WHITE, font_size=24).next_to(text_authors, DOWN, buff=0.35).align_to(text_authors, LEFT)
text_title = text.tex(f'\\textbf{{{self.title}}}', color = WHITE, font_size = 42).next_to(text_affiliation, DOWN, buff=0.35).align_to(text_authors, LEFT)
text_date = text.tex(self.date, color = WHITE, font_size=24).shift(3 * DOWN).align_to(text_authors, LEFT)

render.add(text_authors)
render.add(text_affiliation)
render.add(text_title)
render.add(text_date)

render.wait()




16 changes: 16 additions & 0 deletions scenes/what.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from manim import *
from manim_slides import Slide

from util import text, coordinates

class What(Slide):
def __init__(self):
super().__init__()
self.title = "What is Manim?"


def construct(self, render):
channel = ImageMobject("images/channel.png").scale_to_fit_width(0.8 * render.camera.frame_width)
render.add(channel)

render.wait()
Loading

0 comments on commit 158fc82

Please sign in to comment.