Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add OpenGLText

Devin Neale3153f7d45d7
diff --git a/example_scenes/basic.py b/example_scenes/basic.py
index ddec8fa1d..e4b182f25 100644
--- a/example_scenes/basic.py
+++ b/example_scenes/basic.py
@@ -19,7 +19,7 @@ class TestLatex(Scene):
# mob = SVGMobject("../manim/media/Tex/1e2155e0e4bdc7ad.svg").scale(3)
# mob.set_color(WHITE)
# self.play(FadeIn(mob))
- mob = Tex("C").set_height(7)
+ mob = Text("This is some text").set_width(13)
self.play(Write(mob))
self.wait(2)
diff --git a/example_scenes/opengl.py b/example_scenes/opengl.py
index c43e33ed8..4f4dc2a35 100644
--- a/example_scenes/opengl.py
+++ b/example_scenes/opengl.py
@@ -13,11 +13,11 @@ class TestLatex(Scene):
config["background_color"] = "#333333"
# mob = OpenGLSVGMobject("../manim/media/Tex/184715fb937073ce.svg").scale(3)
# mob.set_color(WHITE)
- mob = OpenGLTex("Manim Community").set_width(12)
- mob2 = OpenGLTex("v4.0").set_width(12)
+ mob = OpenGLCairoText("Manim Community").set_width(12)
self.play(Write(mob))
- self.play(Transform(mob, mob2))
- self.interact()
+ print(len(mob.submobjects))
+ self.wait()
+ # self.interact()
class InteractiveDevelopment(Scene):
diff --git a/manim/mobject/svg/svg_path.py b/manim/mobject/svg/svg_path.py
index 21b7090de..07d89583d 100644
--- a/manim/mobject/svg/svg_path.py
+++ b/manim/mobject/svg/svg_path.py
@@ -90,12 +90,13 @@ class SVGPathMobject(VMobject):
for command, coord_string in pairs:
self.handle_command(command, coord_string, prev_command)
prev_command = command
- if self.should_subdivide_sharp_curves:
- # For a healthy triangulation later
- self.subdivide_sharp_curves()
- if self.should_remove_null_curves:
- # Get rid of any null curves
- self.set_points(self.get_points_without_null_curves())
+ if config["use_opengl_renderer"]:
+ if self.should_subdivide_sharp_curves:
+ # For a healthy triangulation later
+ self.subdivide_sharp_curves()
+ if self.should_remove_null_curves:
+ # Get rid of any null curves
+ self.set_points(self.get_points_without_null_curves())
# people treat y-coordinate differently
self.rotate(np.pi, RIGHT, about_point=ORIGIN)
diff --git a/manim/opengl/__init__.py b/manim/opengl/__init__.py
index e275c6a41..42562c243 100644
--- a/manim/opengl/__init__.py
+++ b/manim/opengl/__init__.py
@@ -6,3 +6,4 @@ from ..mobject.opengl_three_dimensions import *
from ..mobject.opengl_three_dimensions import *
from ..mobject.svg.opengl_svg_mobject import *
from ..mobject.svg.opengl_tex_mobject import *
+from ..mobject.svg.opengl_text_mobject import *