I have a program written in Python geometric algebra that produces animations as mp4s. It is quite crude and I’m looking for something better. The requirements are:
Geometric algebra
Ability to draw ellipses.
Can produce standard MP4s.
I’ll translate from Python to some other language if I must.
Welcome @PatrickPowers
You can do this with Processing’s Python mode –
- for geometric algebra, there’s the PVector class;
- for ellipses, there’s the ellipse() function;
- for MP4s, I’d probably just use the saveFrame() function to generate an image of each frame, then combine them into a video (using FFmpeg or some video editing software).
Your Python script may require some adaption; you’re using the Processing environment, possibly the PVector class, and Processing’s Python mode has some differences (it’s using Jython).
p5 for Python is another (pure Python) option.
2 Likes
There is even one in the menu tools for movie making
2 Likes
Also relying on ffmpeg there is Hamoid’s VideoExport library you can install from the IDE
add_library('VideoExport')
recording = False
def setup():
global video_export
size(600, 600)
noStroke()
frameRate(30)
println(u"Press 'r' to start recording")
println(u"Press 'q' to quit and close recording file")
video_export = VideoExport(this, "animation.mp4")
video_export.setFrameRate(30) # optional (reduce frame rate)
frameRate(30)
# Quality: 100. Audio very good: 256 / good: 192
video_export.setQuality(70, 128) # default de video & audio
video_export.startMovie()
def draw():
background(0)
t = frameCount * 0.03
sz = 100 + 50 * cos(t * 1.33) * cos(t * 1.84)
ellipse(300 + 200 * cos(t * 1.13) * cos(t * 0.21),
300 + 200 * cos(t * 1.71) * cos(t * 0.47),
sz, sz)
if recording:
video_export.saveFrame()
def keyPressed():
global recording
if key == 'r' or key == 'R':
recording = not recording
println(u"Recording is {}".format(
"ON" if video_export else "OFF"))
if key == 'q' or key == 'Q':
video_export.endMovie()
exit()
3 Likes