1.每一次计算都重新画画。
This commit is contained in:
11
animation.py
11
animation.py
@@ -25,18 +25,20 @@ class Animation:
|
||||
if not cls._disable:
|
||||
# print("desc")
|
||||
return func(cls, *args, **kwargs)
|
||||
return not_run(cls,*args, **kwargs)
|
||||
return not_run(cls, *args, **kwargs)
|
||||
|
||||
return wrapTheFunction
|
||||
|
||||
def disable(self, _disable):
|
||||
self._disable = _disable
|
||||
|
||||
@switch_decorator
|
||||
def init_fig(self):
|
||||
ax = self._ax
|
||||
ax.set_aspect(1)
|
||||
ax.set_xlim([-500, 500])
|
||||
ax.set_ylim([-500, 500])
|
||||
|
||||
@switch_decorator
|
||||
def show(self):
|
||||
self._fig.show()
|
||||
@@ -47,10 +49,12 @@ class Animation:
|
||||
x = np.linspace(0, 300)
|
||||
y = line_func(x)
|
||||
ax.plot(x, y)
|
||||
|
||||
@switch_decorator
|
||||
def add_rs(self, rs, rs_x, rs_y):
|
||||
ax = self._ax
|
||||
ax.add_artist(plt.Circle((rs_x, rs_y), rs, fill=False))
|
||||
|
||||
@switch_decorator
|
||||
def add_rc(self, rc, rc_x, rc_y):
|
||||
ax = self._ax
|
||||
@@ -71,15 +75,14 @@ class Animation:
|
||||
ax.plot([rc_x, intersection_x1], [rc_y, intersection_y1], color="red")
|
||||
ax.plot([rc_x, intersection_x2], [rc_y, intersection_y2], color="red")
|
||||
pass
|
||||
|
||||
@switch_decorator
|
||||
def clear(self):
|
||||
ax = self._ax
|
||||
# fig = self._fig
|
||||
ax.cla()
|
||||
|
||||
@switch_decorator
|
||||
def pause(self):
|
||||
# fig=self._fig
|
||||
# print('tick')
|
||||
ax = self._ax
|
||||
self._ticks += 1
|
||||
ticks = self._ticks
|
||||
|
||||
Reference in New Issue
Block a user