SVG to RGB: How to save a series of svg images to video?

As a workaround, you could use Luxor to build an animation from SVG images like this:

using Luxor

function make_an_svg()
    cols = ["#389826", "#cb3c33", "#9558b2"]
    return """
    <svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 512 512">
    <circle fill="$(cols[rand(1:end)])" cx="256" cy="137" r="83"/>
    <circle fill="$(cols[rand(1:end)])" cx="145" cy="329" r="83"/>
    <circle fill="$(cols[rand(1:end)])" cx="367" cy="329" r="83"/></svg>"""
end 
function frame(scene, framenumber)
    background("black")
    placeimage(readsvg(make_an_svg()), O, centered=true)
end
movie = Movie(400, 400, "svg movie")
animate(movie, [Scene(movie, frame, 1:20)], 
    framerate=4, creategif=true)

which generates a frame for each SVG string returned by make_an_svg().

jc

2 Likes