Skip to content

Commit e80642f

Browse files
committed
Add option to DerivationStep to use any kind of matching transform as transition
1 parent 1d56db5 commit e80642f

2 files changed

Lines changed: 5 additions & 52 deletions

File tree

‎animations/QuadraticFormulaDerivation.py‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

‎utils/latex_helpers.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from manim import Scene, MathTex, TransformMatchingTex
2+
from manim.animation.transform_matching_parts import TransformMatchingAbstractBase
23

34

45
START_G = r"\left."
56
END_G = r"\right."
67

78

89
class DerivationStep:
9-
def __init__(self, *tex_strings: str, transition_duration: float = 1, delay: float = 0):
10+
def __init__(self, *tex_strings: str, transition_duration: float = 1, delay: float = 0,
11+
transform_type: type[TransformMatchingAbstractBase] = TransformMatchingTex):
1012
"""
1113
Parameters:
1214
*tex_strings (str):
@@ -22,7 +24,7 @@ def __init__(self, *tex_strings: str, transition_duration: float = 1, delay: flo
2224
self.tex = MathTex(*tex_strings)
2325
self.transition_duration = transition_duration
2426
self.delay = delay
25-
27+
self.transform_type = transform_type
2628

2729
def derive_equation(scene: Scene, base_equation: MathTex, steps: list[DerivationStep]) -> MathTex:
2830
"""
@@ -34,7 +36,7 @@ def derive_equation(scene: Scene, base_equation: MathTex, steps: list[Derivation
3436
current_tex = base_equation
3537
for next_step in steps:
3638
if next_step.delay: scene.wait(next_step.delay)
37-
scene.play(TransformMatchingTex(
39+
scene.play(next_step.transform_type(
3840
current_tex, next_step.tex,
3941
run_time=next_step.transition_duration
4042
))

0 commit comments

Comments
 (0)