mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Show examples of indexing by substrings and regular expressions
This commit is contained in:
parent
fdccfd51fc
commit
632819dd6d
1 changed files with 12 additions and 5 deletions
|
@ -193,11 +193,7 @@ class TexTransformExample(Scene):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.wait()
|
self.wait()
|
||||||
self.play(
|
self.play(TransformMatchingStrings(lines[1].copy(), lines[2]))
|
||||||
TransformMatchingStrings(
|
|
||||||
lines[1].copy(), lines[2],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
self.wait()
|
self.wait()
|
||||||
self.play(
|
self.play(
|
||||||
TransformMatchingStrings(
|
TransformMatchingStrings(
|
||||||
|
@ -208,6 +204,17 @@ class TexTransformExample(Scene):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
self.wait(2)
|
self.wait(2)
|
||||||
|
|
||||||
|
# You can also index into Tex mobject (or other StringMobjects)
|
||||||
|
# by substrings and regular expressions
|
||||||
|
top_equation = lines[0]
|
||||||
|
low_equation = lines[3]
|
||||||
|
|
||||||
|
self.play(LaggedStartMap(FlashAround, low_equation["C"], lag_ratio=0.5))
|
||||||
|
self.play(LaggedStartMap(FlashAround, low_equation["B"], lag_ratio=0.5))
|
||||||
|
self.play(LaggedStartMap(FlashAround, top_equation[re.compile(r"\w\^2")]))
|
||||||
|
self.play(Indicate(low_equation[R"\sqrt"]))
|
||||||
|
self.wait()
|
||||||
self.play(LaggedStartMap(FadeOut, lines, shift=2 * RIGHT))
|
self.play(LaggedStartMap(FadeOut, lines, shift=2 * RIGHT))
|
||||||
|
|
||||||
# TransformMatchingShapes will try to line up all pieces of a
|
# TransformMatchingShapes will try to line up all pieces of a
|
||||||
|
|
Loading…
Add table
Reference in a new issue