# HG changeset patch # User William Stein # Date 1246372477 -7200 # Node ID 0fe38a2b742aca6d79ce9457da8536adc29a3048 # Parent 0ee125b9c62b838cf034e1de0c81313def06049f trac #1483 -- javascript animation in the notebook diff -r 0ee125b9c62b -r 0fe38a2b742a sage/plot/animate.py --- a/sage/plot/animate.py Mon Jun 29 16:42:16 2009 -0700 +++ b/sage/plot/animate.py Tue Jun 30 16:34:37 2009 +0200 @@ -361,11 +361,16 @@ - ``iterations`` - integer (default: 0); number of iterations of animation. If 0, loop forever. + + EXAMPLES:: + sage: a = animate([sin(x + float(k)) for k in srange(0,pi,0.3)], xmin=0, xmax=2*pi, figsize=[2,1]) + sage: a.js() + ... """ msec = delay*10 # delay in milliseconds d = self.png() from sage.misc.prandom import randint - r = randint(1,1000) + r = randint(1,1000000000) file_list = os.listdir(d) file_list.sort() cell_dir = os.path.join(os.path.dirname(os.path.abspath("")), "anim%s"%r) @@ -376,26 +381,26 @@ shutil.copy(os.path.join(d, f), os.path.join(cell_dir, f)) v = [os.path.join(link_path, f) for f in file_list] + v.sort() - s = '' - s += """ - """%(r, r, r, msec, r) + s = """ + + """%r + s + s = '%s'%s + #print '%s'%s + return s def show(self, delay=20, iterations=0):