commit a48448c33e150c60f6050172db30191e3b455c84
parent 9a9b60a1002b70c52cbcd5451b687840aa9867af
Author: Anders Damsgaard <andersd@riseup.net>
Date: Wed, 1 Nov 2017 14:00:40 -0400
add option to additionally render animation in reverse
Diffstat:
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/examples/logo.jl b/examples/logo.jl
@@ -166,4 +166,4 @@ Granular.setOutputFileInterval!(sim, .1)
Granular.removeSimulationFiles(sim)
Granular.run!(sim, verbose=verbose)
-Granular.render(sim, images=true, animation=false)
+Granular.render(sim, images=true, animation=false, reverse=true)
diff --git a/src/io.jl b/src/io.jl
@@ -924,7 +924,8 @@ from the shell using the supplied `pvpython` argument.
"""
function render(simulation::Simulation; pvpython::String="pvpython",
images::Bool=true,
- animation::Bool=false)
+ animation::Bool=false,
+ reverse::Bool=false)
writeParaviewPythonScript(simulation, save_animation=animation,
save_images=images, verbose=false)
@@ -937,6 +938,12 @@ function render(simulation::Simulation; pvpython::String="pvpython",
run(`convert -trim +repage -delay 10 -transparent-color white
-loop 0 $(simulation.id)/$(simulation.id).'*'.png
$(simulation.id)/$(simulation.id).gif`)
+ if reverse
+ run(`convert -trim +repage -delay 10 -transparent-color white
+ -loop 0 -reverse
+ $(simulation.id)/$(simulation.id).'*'.png
+ $(simulation.id)/$(simulation.id)-reverse.gif`)
+ end
catch return_signal
if isa(return_signal, Base.UVError)
info("Skipping gif merge since `convert` was not found.")