mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Fix bug with pi creature
This commit is contained in:
parent
c88bcc1a3c
commit
16ea2a0104
3 changed files with 17 additions and 13 deletions
|
@ -149,9 +149,7 @@ class PiCreature(SVGMobject):
|
|||
return self
|
||||
|
||||
def change_mode(self, mode):
|
||||
new_self = self.__class__(
|
||||
mode=mode,
|
||||
)
|
||||
new_self = self.__class__(mode=mode)
|
||||
new_self.match_style(self)
|
||||
new_self.match_height(self)
|
||||
if self.is_flipped() != new_self.is_flipped():
|
||||
|
@ -211,10 +209,11 @@ class PiCreature(SVGMobject):
|
|||
|
||||
def blink(self):
|
||||
eye_parts = self.eye_parts
|
||||
eye_bottom_y = eye_parts.get_bottom()[1]
|
||||
eye_parts.apply_function(
|
||||
lambda p: [p[0], eye_bottom_y, p[2]]
|
||||
)
|
||||
eye_bottom_y = eye_parts.get_y(DOWN)
|
||||
|
||||
for eye_part in eye_parts:
|
||||
eye_part.points[:, 1] = eye_bottom_y
|
||||
|
||||
return self
|
||||
|
||||
def to_corner(self, vect=None, **kwargs):
|
||||
|
|
|
@ -322,6 +322,11 @@ class SVGMobject(VMobject):
|
|||
|
||||
|
||||
class VMobjectFromSVGPathstring(VMobject):
|
||||
CONFIG = {
|
||||
"long_lines": True,
|
||||
"subdivide_sharp_curves": False,
|
||||
}
|
||||
|
||||
def __init__(self, path_string, **kwargs):
|
||||
self.path_string = path_string
|
||||
VMobject.__init__(self, **kwargs)
|
||||
|
@ -345,8 +350,9 @@ class VMobjectFromSVGPathstring(VMobject):
|
|||
for command, coord_string in self.get_commands_and_coord_strings():
|
||||
new_points = self.string_to_points(command, coord_string)
|
||||
self.handle_command(command, new_points)
|
||||
# For a healthy triangulation later
|
||||
self.subdivide_sharp_curves()
|
||||
if self.subdivide_sharp_curves:
|
||||
# For a healthy triangulation later
|
||||
self.subdivide_sharp_curves()
|
||||
# SVG treats y-coordinate differently
|
||||
self.stretch(-1, 1, about_point=ORIGIN)
|
||||
# Save to a file for future use
|
||||
|
|
|
@ -16,10 +16,9 @@ TEX_MOB_SCALE_FACTOR = 0.05
|
|||
|
||||
|
||||
class TexSymbol(VMobjectFromSVGPathstring):
|
||||
"""
|
||||
Purely a renaming of VMobjectFromSVGPathstring
|
||||
"""
|
||||
pass
|
||||
CONFIG = {
|
||||
"subdivide_sharp_curves": True,
|
||||
}
|
||||
|
||||
|
||||
class SingleStringTexMobject(SVGMobject):
|
||||
|
|
Loading…
Add table
Reference in a new issue