mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 08:54:38 +08:00
More fractal additions
This commit is contained in:
@ -62,6 +62,8 @@ class SVGMobject(VMobject):
|
||||
result.append(self.rect_to_mobject(element))
|
||||
elif element.tagName == 'circle':
|
||||
result.append(self.circle_to_mobject(element))
|
||||
elif element.tagName == 'polygon':
|
||||
result.append(self.polygon_to_mobject(element))
|
||||
else:
|
||||
warnings.warn("Unknown element type: " + element.tagName)
|
||||
result = filter(lambda m : m is not None, result)
|
||||
@ -86,6 +88,14 @@ class SVGMobject(VMobject):
|
||||
self.ref_to_element[ref]
|
||||
)
|
||||
|
||||
def polygon_to_mobject(self, polygon_element):
|
||||
#TODO, This seems hacky...
|
||||
path_string = polygon_element.getAttribute("points")
|
||||
for digit in string.digits:
|
||||
path_string = path_string.replace(" " + digit, " L" + digit)
|
||||
path_string = "M" + path_string
|
||||
return self.path_string_to_mobject(path_string)
|
||||
|
||||
# <circle class="st1" cx="143.8" cy="268" r="22.6"/>
|
||||
|
||||
def circle_to_mobject(self, circle_element):
|
||||
|
Reference in New Issue
Block a user