0

Hay guys I want to make animated gifs. Is there a way to write this a lot shorter?

 draw(terminal   = animated_gif,
             delay      = 40,
             file_name  = "gifanim",
             pic_width  = 300,
             pic_height = 300,
             gr2d(explicit(x^0.1,x,0,1)),
             gr2d(explicit(x^0.2,x,0,1)),
             gr2d(explicit(x^0.3,x,0,1)),
             gr2d(explicit(x^0.4,x,0,1)),
             gr2d(explicit(x^0.5,x,0,1)),
             gr2d(explicit(x^0.6,x,0,1)),
             gr2d(explicit(x^0.7,x,0,1)),
             gr2d(explicit(x^0.8,x,0,1)),
             gr2d(explicit(x^0.9,x,0,1)),
             gr2d(explicit(x^1,x,0,1)) );

I want to do something like this...

draw(terminal   = animated_gif,
                 delay      = 40,
                 file_name  = "gifanim",
                 pic_width  = 300,
                 pic_height = 300,
 for i : 0.1 thru 1 do
    a: explicit(x^i,x,0,1);
                 gr2d(a[i])));

I just want this shorter. Kind regards.

AngularLover
  • 364
  • 1
  • 12

2 Answers2

2

My advice is to create the list of gr2d(whatever) objects, append that to the list of plotting options, then apply draw to that. E.g. something like:

makelist (gr2d (explicit (x^(i/10), x, 0, 1)), i, 1, 10);
append ([terminal   = animated_gif,
             delay      = 40,
             file_name  = "gifanim",
             pic_width  = 300,
             pic_height = 300], %);
draw (%);

It's possible to put all that stuff into a macro -- let me know if you want help with that.

Robert Dodier
  • 16,905
  • 2
  • 31
  • 48
1

If you're using wxMaxima, you can create an animated plot using with_slider_draw:

with_slider_draw(
    d,
    makelist(i,i,0.1,1,0.1),
    explicit(x^d, x, 0, 1)
)$

Now right-click on the plot and choose "Save Animation". This saves as an animated GIF.

enter image description here

Fred Senese
  • 660
  • 5
  • 9