Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Section Title #17

Merged
merged 4 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ channels:

dependencies:
- python=3.11
- manim==0.17.*
- manim==0.18.*
- pip
- pip:
- -e .[dev]
2 changes: 1 addition & 1 deletion src/powermanim/components/chartbars.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import itertools
from typing import Iterable, Sequence

from colour import Color
from manim import ManimColor as Color
from manim import *


Expand Down
4 changes: 2 additions & 2 deletions src/powermanim/showcase/templates/sectiontitle.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def showcasing():

def construct(self):
title = SectionTitle("Section Title")
title.show(self)
self.play(title.show())
self.wait(1)
title.hide(self)
self.play(title.hide())
self.wait(1)
26 changes: 12 additions & 14 deletions src/powermanim/templates/sectiontitle.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from manim import ManimColor as Color
from manim import *
from manim.utils.color import Color


class SectionTitle(VGroup):
Expand Down Expand Up @@ -34,31 +34,29 @@ def __init__(

super().__init__(self.slide_title)

def show(self, scene: Scene) -> None:
def show(self) -> Animation:
"""Show the section title.

Args:
scene (Scene): the scene.
"""
scene.play(
AnimationGroup(
DrawBorderThenFill(self.slide_title, run_time=self.in_run_time),
Circumscribe(
self.slide_title,
color=self.border_color,
buff=self.border_buff,
),
lag_ratio=self.border_lag_ratio,
)
return AnimationGroup(
DrawBorderThenFill(self.slide_title, run_time=self.in_run_time),
Circumscribe(
self.slide_title,
color=self.border_color,
buff=self.border_buff,
),
lag_ratio=self.border_lag_ratio,
)

def hide(self, scene: Scene) -> None:
def hide(self) -> Animation:
"""Hide the section title.

Args:
scene (Scene): the scene.
"""
scene.play(
return AnimationGroup(
FadeOut(self.slide_title, shift=self.out_shift),
run_time=self.out_run_time,
)
Loading