I've made a little proof-of-concept from the timer interact widget and this -- I think it's pretty awesome:
1) apply http://sage.math.washington.edu/home/boothby/timer.patch 2) upload jquery.flot_r135.js into the data directory of a worksheet 3) paste the attached into a worksheet (in edit mode) 4) Press "start" Currently, changing more than one @interact widget at a time "forgets", everything but the first. So, to play with the slider while the timer is running, you might have to change the "t=timer(1000)" in the @interact to "t=timer(2000)" or bigger, depending on processor speed / network latency. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
{{{id=0| def flot(F,x,L): d = [] for f in F: d.append([f(t) for t in x]) return "<script>setTimeout(%r)</script>"%flotData(x,d,L) def flotData(xdata, Y, L): s = 'var splot = [' s+= ",".join(['{ data:'+str([[a,b] for a,b in zip(xdata,ydata)])+',label: "'+l+'"}' for ydata,l in zip(Y,L)]) s+= '];' s+= r""" var options1 = { crosshair: { mode: "xy", color: "#ff0000" }, lines: { show: true }, xaxis: { ticks: 6 }, yaxis: { ticks: 4, tickDecimals: 0, min: -2, max:2 }, selection: { mode: "xy" }, grid: { hoverable: true, clickable: true , color: "#999"} }; var placeholdermag = \$("#placeholdermag"); var plotm = \$.plot(placeholdermag, splot, options1); """ return s /// }}} {{{id=4| html("<script src='data/jquery.flot_r135.js'></script>") }}} {{{id=1| from sage.server.notebook.interact import timer from math import sin print html('<div id="placeholdermag" style="width:750px;height:300px;"></div>') @interact def _(t=timer(1000),steps=(5..100)): p = 2*float(pi) t = p*(t%steps)/steps def f1(s): return sin(s) def f2(s): m = cos(t) return f1(t) + (s-t)*m print html(flot([f1,f2],[0,.1,..,p], ["sin(x)","L(x)"] )) }}}