Skip to content

Commit

Permalink
Finish slides
Browse files Browse the repository at this point in the history
  • Loading branch information
aannleax committed Aug 20, 2024
1 parent 158fc82 commit 4249e6b
Show file tree
Hide file tree
Showing 13 changed files with 283 additions and 12 deletions.
Binary file added images/TrieJoin.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/buildings.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 modified 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/flowers.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/github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scenes/animation_a.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
class AnimationA(Slide):
def __init__(self):
super().__init__()
self.title = "Example (1)"
self.title = "Example (2)"
self.triangle_color = BLUE

def construct(self, render):
Expand Down
133 changes: 127 additions & 6 deletions scenes/animation_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,138 @@

from util import text, coordinates

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

RECT_COLOR=RED
CURSOR_COLOR=GREEN
CURSOR_WIDTH=0.5
CURSOR_HEIGHT=0.6

def create_cursor(self, render):
cursor = Rectangle(stroke_width=0, fill_opacity=0.6, fill_color=self.CURSOR_COLOR, width=self.CURSOR_WIDTH, height=self.CURSOR_HEIGHT)
render.add(cursor)

return cursor

def create_cover(self, render, width, height, x, y):
cover = Rectangle(stroke_width=0, color=BLUE, fill_opacity=1.0, fill_color=WHITE, width=width, height=height).move_to(np.array([x, y, 0]))
render.add(cover)

return cover

def construct(self, render):
my_text = text.tex("Test").next_to(coordinates.UPPER_LEFT)
render.add(my_text)
img = ImageMobject("images/TrieJoin.png")
render.add(img)

cover_135 = self.create_cover(render, 1.5, 1.8, 4.6, 1.55)
cover_35 = self.create_cover(render, 1.0, 2.9, 3.8, -0.85)
cover_3 = self.create_cover(render, 0.6, 1.5, 3.75, -1.6)
cover_2 = self.create_cover(render, 1.0, 2.9, 5.8, 0.5)
cover_928 = self.create_cover(render, 1.2, 3.0, 4.9, -0.85)

render.wait()
render.next_slide()

render.wait(0.5)

rect_left = Rectangle(color=self.RECT_COLOR, width=0.1, height=0.1).move_to(np.array([-4.1, 1.1, -1.0]))
render.add(rect_left)

rect_left_x = Rectangle(color=self.RECT_COLOR, width=2.8, height=0.6).move_to(np.array([-4, -0.15, 0]))

render.play(Transform(rect_left, rect_left_x))

render.wait(0.5)

cursor_left_x = self.create_cursor(render).move_to(np.array([-5, -0.15, 0]))
render.play(FadeIn(cursor_left_x))

render.wait(0.5)

render.play(FadeOut(cover_135))

render.wait(0.5)

rect_right = Rectangle(color=self.RECT_COLOR, width=0.1, height=0.1).move_to(np.array([-0.1, 1.1, -1.0]))
render.add(rect_right)

rect_left_y = Rectangle(color=self.RECT_COLOR, width=2.2, height=0.6).move_to(np.array([-5, -1.65, 0]))
rect_right_y = Rectangle(color=self.RECT_COLOR, width=2.8, height=0.6).move_to(np.array([-0.1, -0.15, 0]))

render.play(
Transform(rect_left, rect_left_y),
Transform(rect_right, rect_right_y)
)

render.wait(0.5)

cursor_left_y = self.create_cursor(render).move_to(np.array([-5.65, -1.65, 0]))
cursor_right_y = self.create_cursor(render).move_to(np.array([-1.0, -0.15, 0]))

# render.play(
# FadeIn(cursor_left_y),
# cursor_right_y.animate.move_to(np.array([-0.15, -0.15, 0]))
# )

# render.wait(0.5)

# render.play(FadeOut(cover_35))

# render.wait(0.5)

# rect_right_z = Rectangle(color=self.RECT_COLOR, width=0.55, height=0.6).move_to(np.array([-0.15, -1.65, 0]))

# render.play(
# Transform(rect_right, rect_right_z),
# FadeOut(cover_3)
# )

# render.wait(0.5)

# render.play(
# Transform(rect_right, rect_right_y)
# )

# render.wait(0.5)

# render.play(
# cursor_left_y.animate.move_to(np.array([-4.35, -1.65, 0])),
# cursor_right_y.animate.move_to(np.array([0.85, -0.15, 0]))
# )

# render.wait(0.5)

# render.play(FadeOut(cover_928))

# render.wait(0.5)

# rect_right_start = Rectangle(stroke_width=0, color=self.RECT_COLOR, width=0.1, height=0.1).move_to(np.array([-0.1, 1.1, -1.0]))
# render.play(
# Transform(rect_right, rect_right_start),
# Transform(rect_left, rect_left_x),
# FadeOut(cursor_right_y),
# FadeOut(cursor_left_y)
# )

# render.wait(0.5)

# render.play(
# cursor_left_x.animate.move_to([-3, -0.15, 0])
# )

# render.wait(0.5)

# rect_left_y_2 = Rectangle(color=self.RECT_COLOR, width=2.2, height=0.6).move_to(np.array([-3, -1.65, 0]))
# render.play(
# Transform(rect_left, rect_left_y_2),
# Transform(rect_right, rect_right_y)
# )

# render.wait(0.5)

circle = Circle(radius=2, color=BLUE)
render.add(circle)
# render.play(FadeOut(cover_2))

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

from util import text, coordinates

class HelloWorld(Slide):
def __init__(self):
super().__init__()
self.title = None


def construct(self, render):
black = Rectangle(color=BLACK, fill_color=BLACK, fill_opacity=1.0, height=render.camera.frame_height, width=render.camera.frame_width)
render.add(black)

circle = Circle()
circle.set_fill(PINK, opacity=0.5)
render.play(Create(circle))

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

from util import text, coordinates

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


def construct(self, render):
text_linux = text.tex("Install dependencies on Linux:").next_to(coordinates.UPPER_LEFT, RIGHT).shift(0.25*DOWN)
render.add(text_linux)

dependency_linux = Code(code=r"""
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
""", language="sh", font_size=160).next_to(text_linux, DOWN).set_x(0)
render.add(dependency_linux)

text_macos = text.tex("Install dependencies on MacOS:").next_to(dependency_linux, DOWN, buff=0.5).align_to(text_linux, LEFT)
render.add(text_macos)

dependency_macos = Code(code=r"""
brew install py3cairo ffmpeg
brew install pango pkg-config scipy
""", language="sh", font_size=160).next_to(text_macos, DOWN).set_x(0)
render.add(dependency_macos)

text_manim_slides = text.tex("Install manim-slides:").next_to(dependency_macos, DOWN, buff=0.5).align_to(text_linux, LEFT)
render.add(text_manim_slides)

install_slides = Code(code=r"""
pip install manim-slides[manim]
""", language="sh", font_size=160).next_to(text_manim_slides, DOWN).set_x(0)
render.add(install_slides)

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

from util import text, coordinates

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

def static(self, render, position):
my_text = text.tex(r"Some text with math: ${a \over b} = c$").next_to(coordinates.UPPER_LEFT)

flowers = ImageMobject(
"images/flowers.png"
).scale_to_fit_height(3).next_to(
my_text, DOWN, aligned_edge=LEFT, buff=1.0
).shift(RIGHT)

buildings= ImageMobject(
"images/buildings.jpg"
).scale_to_fit_height(3).next_to(flowers, RIGHT).set_x(-flowers.get_x())

group = Group(my_text, flowers, buildings).scale_to_fit_width(4.25).next_to(position, DOWN, buff=2.0)
render.add(group)

box = Rectangle(width=5, height=3, color=BLACK).move_to(group)
render.add(box)



def animated(self, render, position):
circle = Circle(fill_color=RED, fill_opacity=1.0).move_to(4*LEFT)
triangle = Triangle(color=GREEN)
rectangle = Rectangle(width=2.0, height=2.0, color=BLUE).move_to(4*RIGHT)

group = VGroup(circle, triangle, rectangle).scale_to_fit_width(4.25).next_to(position, DOWN, buff=3.0)
render.add(group)

box = Rectangle(width=5, height=3, color=BLACK).move_to(group).shift(0.5*UP)
render.add(box)

render.wait()
render.next_slide(loop=True)

render.play(circle.animate.set_fill(BLUE))
render.play(triangle.animate.shift(1*UP), run_time=2.0)
render.play(rectangle.animate.scale(1.5))

def construct(self, render):
part_a = text.tex("Part 1", font_size=46).next_to(2.5*UP, LEFT, buff=3.0)
part_b = text.tex("Part 2", font_size=46).next_to(2.5*UP, RIGHT, buff=3.0)
render.add(part_a)
render.add(part_b)

self.static(render, part_a)
self.animated(render, part_b)

render.wait()
19 changes: 19 additions & 0 deletions scenes/project.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 Project(Slide):
def __init__(self):
super().__init__()
self.title = "Prepared Template"


def construct(self, render):
url = text.tex(r"Starting Point: https://github.com/aannleax/manim-template").next_to(coordinates.UPPER_LEFT).shift(0.25*DOWN)
render.add(url)

github = ImageMobject("images/github.png").scale_to_fit_height(5).shift(0.25*DOWN)
render.add(github)

render.wait()
7 changes: 7 additions & 0 deletions scenes/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def construct(self, render):
render.add(text_date)

render.wait()
render.next_slide()

text_manim = text.tex(r"\textbf{Manim}", color=WHITE, font_size=124).next_to(text_title, DOWN, buff=0.5).shift(0.75*LEFT)
text_manim.add_updater(lambda object: object.rotate(0.105))
render.play(GrowFromCenter(text_manim))

render.wait()



Expand Down
17 changes: 12 additions & 5 deletions slides.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@

from util import text, coordinates

from scenes import title, what, community, animation_a
from scenes import title, what, community, animation_a, animation_b, installation, hello_world, outline, project

create_title = False
create_title = True

# Put your slides here
slides = [
# what.What(),
# community.Community(),
what.What(),
community.Community(),
animation_b.AnimationB(),
animation_a.AnimationA(),
hello_world.HelloWorld(),
outline.Outline(),
project.Project(),
installation.Installation(),
]

title_long = "Creating Animated Slides With"
Expand Down Expand Up @@ -63,7 +68,9 @@ def construct(self):

self.clear()
self.draw_background(index + 1, len(slides))
self.draw_slide_title(slide.title)

if slide.title is not None:
self.draw_slide_title(slide.title)

slide.construct(self)

Expand Down

0 comments on commit 4249e6b

Please sign in to comment.