From 723103fb9af8b36cd56cde345824dac247fd4384 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Wed, 16 Dec 2015 19:49:21 -0800 Subject: [PATCH] Minor improvements to vibrating string, plus copy method to animation --- animation/animation.py | 4 ++++ animation/playground.py | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/animation/animation.py b/animation/animation.py index 5b001982..b1251495 100644 --- a/animation/animation.py +++ b/animation/animation.py @@ -6,6 +6,7 @@ import time import os import progressbar import inspect +from copy import deepcopy from 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.0 diff --git a/animation/playground.py b/animation/playground.py index 2c1c6227..e3d24e4c 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)