Okay, this is somewhat baroque but might be helpful. One of the main
things is the zero-padding of file names, e.g. in the line "fname =
prelabel + '0'*(3-len(str(i)))+str(i)":
def tachbs(p, th = .2, fade = 1.0, xres = 500, yres = 500, **kwds):
c_center = [2*max([q[i] for q in p.vertices()]) for i in range(3)]
c_center[0],c_center[1] = c_center[0]*cos(th)+c_center[1]*sin(th),-
c_center[0]*sin(th)+c_center[1]*cos(th)
t = Tachyon(xres = xres, yres = yres, camera_center = c_center,
**kwds)
lightc = [x for x in c_center]
lightc[2] += 5
t.light(lightc,.5,(1.0,0.0,1.0))
t.texture('mattered',color = (1.0,0,0), ambient = .2*fade, opacity
= 1.0*fade, diffuse = .8*fade)
t.texture('matteblue',color = (0,0,1.0), ambient = .2*fade,
opacity = 1.0*fade, diffuse = .8*fade)
for q in p.vertices():
t.sphere(q,.05,'mattered')
for q in p.vertex_adjacencies():
q1 = q[0]
for q2 in q[1]:
t.fcylinder(p.vertices()[q1], p.vertices()[q2], .01,
'matteblue')
return t
def makeblackframe(fname, xres = 500, yres = 500):
t = Tachyon(xres = xres, yres = yres)
t.save(fname)
pico = polytopes.icosahedron()
prelabel = 'demo'
npi = RDF(pi)
frames = 120
for i in srange(0,frames):
if mod(i,20)==0: print i
fname = prelabel + '0'*(3-len(str(i)))+str(i)
tachbs(pico,th = 2.0*npi*i/(frames-1.0), antialiasing=True,
raydepth = 6).save(DATA+fname+'.png')
makeblackframe(DATA+ prelabel + '0'*(3-len(str(i+1)))+str(i+1)
+'.png')
os.system('ffmpeg -qmax 2 -r 20 -i ' + DATA + prelabel + '%3d.png ./'
+ prelabel +'.mp4')
-Marshall
On Mar 3, 11:08 am, Christopher Olah <[email protected]>
wrote:
> On Thu, Feb 18, 2010 at 8:14 AM, Marshall Hampton <[email protected]> wrote:
> > I recommend using ffmpeg for stuff like that, it will do a better job
> > than animate as long as animate is just using imagemagick. You need
> > to save the image files with sequential names. I can post an example
> > if you are interested.
>
> Sure.
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org