0
$\begingroup$

I want to use Wolfram Script to create a sequence of PNG images depending on some parameter (which I then turn into a movie). Currently I do this with a for loop. I would like to avoid having to write a for loop each time and instead define a function which takes one (or several) time-dependent plot(s) as an input and creates the sequence of images. Here's what I tried so far

#!/usr/bin/env wolframscript

fps=30;
durationofmovie=1;

timedependentplot[time_]=ParametricPlot[{time*s,time*s^2},{s,0,1},PlotStyle->{blue,Thickness[0.005]},Axes->None,PlotRangeClipping->False,PlotRange->{{-1,1},{-1,1}}];

CreateImageSequence[timedependentplot_]:=For[i=0,i<=fps*durationofmovie,i++,t=1/(fps*durationofmovie)*i;
Export[ToString[IntegerString[i,10,4]]<>".png",Show[timedependentplot[t]],RasterSize->{480,360}]
];

CreateImageSequence[timedependentplot];

but things don't work. That is, the resulting images are just white.

$\endgroup$
1
$\begingroup$

Use SetDelayed:

timedependentplot[time_] := ParametricPlot[{time*s, time*s^2}, {s, 0, 1}, 
   PlotStyle -> {Blue, Thickness[0.005]}, Axes -> None, 
   PlotRangeClipping -> False, PlotRange -> {{-1, 1}, {-1, 1}}];
$\endgroup$
1
  • $\begingroup$ Duh, stupid typo! Many thanks! $\endgroup$ – 220284 Jun 10 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.