A community-maintained Python framework for creating mathematical animations.
Minor improvements to vibrating string, plus copy method to animation
Grant Sanderson723103fb9af8
diff --git a/animation/animation.py b/animation/animation.pyindex 5b001982a..b1251495d 100644--- a/animation/animation.py+++ b/animation/animation.py@@ -6,6 +6,7 @@ import timeimport osimport progressbarimport inspect+from copy import deepcopyfrom helpers import *from mobject import Mobject@@ -30,6 +31,9 @@ class Animation(object):def __str__(self):return self.name+ def copy(self):+ return deepcopy(self)+def update(self, alpha):if alpha < 0:alpha = 0.0diff --git a/animation/playground.py b/animation/playground.pyindex 2c1c62274..e3d24e4c2 100644--- a/animation/playground.py+++ b/animation/playground.py@@ -9,13 +9,13 @@ from helpers import *class VibratingString(Animation):DEFAULT_CONFIG = {"num_periods" : 1,- "overtones" : 4,- "amplitude" : 0.5,- "radius" : SPACE_WIDTH/2,- "center" : ORIGIN,- "color" : "white",- "run_time" : 3.0,- "alpha_func" : None+ "overtones" : 4,+ "amplitude" : 0.5,+ "radius" : SPACE_WIDTH/2,+ "center" : ORIGIN,+ "color" : "white",+ "run_time" : 3.0,+ "alpha_func" : None}def __init__(self, **kwargs):digest_config(self, kwargs)