mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Changed Rectangle implementation
This commit is contained in:
parent
d489b5df5c
commit
7a488702e4
1 changed files with 7 additions and 19 deletions
|
@ -616,13 +616,9 @@ class Vector(Arrow):
|
||||||
|
|
||||||
|
|
||||||
class DoubleArrow(Arrow):
|
class DoubleArrow(Arrow):
|
||||||
def init_tip(self):
|
def __init__(self, *args, **kwargs):
|
||||||
self.tip = VGroup()
|
Arrow.__init__(self, *args, **kwargs)
|
||||||
for b in True, False:
|
self.add_tip(at_start=True)
|
||||||
t = self.add_tip(add_at_end=b)
|
|
||||||
t.add_at_end = b
|
|
||||||
self.tip.add(t)
|
|
||||||
self.tip.match_style(self.tip[0])
|
|
||||||
|
|
||||||
|
|
||||||
class CubicBezier(VMobject):
|
class CubicBezier(VMobject):
|
||||||
|
@ -633,9 +629,7 @@ class CubicBezier(VMobject):
|
||||||
|
|
||||||
class Polygon(VMobject):
|
class Polygon(VMobject):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"color": GREEN_D,
|
"color": BLUE,
|
||||||
"mark_paths_closed": True,
|
|
||||||
"close_new_points": True,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *vertices, **kwargs):
|
def __init__(self, *vertices, **kwargs):
|
||||||
|
@ -704,15 +698,9 @@ class Rectangle(Polygon):
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
digest_config(self, kwargs)
|
Polygon.__init__(self, UL, UR, DR, DL, **kwargs)
|
||||||
x, y = self.width / 2., self.height / 2.
|
self.set_width(self.width, stretch=True)
|
||||||
vertices = [
|
self.set_height(self.height, stretch=True)
|
||||||
x * LEFT + y * UP,
|
|
||||||
x * RIGHT + y * UP,
|
|
||||||
x * RIGHT + y * DOWN,
|
|
||||||
x * LEFT + y * DOWN
|
|
||||||
]
|
|
||||||
Polygon.__init__(self, *vertices, **kwargs)
|
|
||||||
|
|
||||||
|
|
||||||
class Square(Rectangle):
|
class Square(Rectangle):
|
||||||
|
|
Loading…
Add table
Reference in a new issue