87
87
....: (x, -2, 2), (y, -2, 2), (z, -2, 2),
88
88
....: plot_points=60, contour=[1,3,5],
89
89
....: region=lambda x,y,z: x<=t or y>=t or z<=t)
90
- sage: a = animate([frame(t)
91
- ....: for t in srange(.01,1.5,.2)])
90
+ sage: a = animate([frame(t) for t in srange(.01, 1.5, .2)])
92
91
sage: a[0] # long time
93
92
Graphics3d Object
94
93
sage: a.show() # long time # optional -- ImageMagick
99
98
illustrated by the following example::
100
99
101
100
sage: t = SR.var("t")
102
- sage: a = animate((sin(c*pi*t)
103
- ....: for c in sxrange(1, 2, .2)))
101
+ sage: a = animate((sin(c*pi*t) for c in sxrange(1, 2, .2)))
104
102
sage: a.show() # long time # optional -- ImageMagick
105
103
106
104
@@ -149,8 +147,7 @@ def animate(frames, **kwds):
149
147
EXAMPLES::
150
148
151
149
sage: t = SR.var("t")
152
- sage: a = animate((cos(c*pi*t)
153
- ....: for c in sxrange(1, 2, .2)))
150
+ sage: a = animate((cos(c*pi*t) for c in sxrange(1, 2, .2)))
154
151
sage: a.show() # long time # optional -- ImageMagick
155
152
156
153
See also :mod:`sage.plot.animate` for more examples.
@@ -163,7 +160,6 @@ class Animation(WithEqualityById, SageObject):
163
160
164
161
INPUT:
165
162
166
-
167
163
- ``v`` -- iterable of Sage objects. These should preferably be
168
164
graphics objects, but if they aren't, then :meth:`make_image` is
169
165
called on them.
@@ -178,8 +174,7 @@ class Animation(WithEqualityById, SageObject):
178
174
EXAMPLES::
179
175
180
176
sage: x = SR.var("x")
181
- sage: a = animate([sin(x + float(k))
182
- ....: for k in srange(0, 2*pi, 0.3)],
177
+ sage: a = animate([sin(x + float(k)) for k in srange(0, 2*pi, 0.3)],
183
178
....: xmin=0, xmax=2*pi, figsize=[2,1])
184
179
sage: print(a)
185
180
Animation with 21 frames
@@ -533,7 +528,7 @@ def graphics_array(self, ncols=3):
533
528
sage: a = animate(v, xmin=0, ymin=0, axes=False)
534
529
sage: print(a)
535
530
Animation with 3 frames
536
- sage: a.show() # optional - imagemagick
531
+ sage: a.show() # optional -- ImageMagick
537
532
538
533
Modify the default arrangement of array::
539
534
@@ -615,7 +610,7 @@ def gif(self, delay=20, savefile=None, iterations=0, show_path=False,
615
610
sage: a.gif(savefile=td + 'my_animation.gif', # long time # optional -- ImageMagick
616
611
....: show_path=True)
617
612
Animation saved to .../my_animation.gif.
618
- sage: a.gif(savefile=td + 'my_animation_2.gif', # long time # optional -- ffmpeg
613
+ sage: a.gif(savefile=td + 'my_animation_2.gif', # long time # optional -- FFmpeg
619
614
....: show_path=True, use_ffmpeg=True)
620
615
Animation saved to .../my_animation_2.gif.
621
616
@@ -853,15 +848,15 @@ def show(self, delay=None, iterations=None, **kwds):
853
848
854
849
You can also make use of the HTML5 video element in the Sage Notebook::
855
850
856
- sage: # long time, optional - ffmpeg
851
+ sage: # long time, optional -- FFmpeg
857
852
sage: a.show(format="ogg")
858
853
sage: a.show(format="webm")
859
854
sage: a.show(format="mp4")
860
855
sage: a.show(format="webm", iterations=1)
861
856
862
857
Other backends may support other file formats as well::
863
858
864
- sage: # long time, optional - ffmpeg
859
+ sage: # long time, optional -- FFmpeg
865
860
sage: a.show(format="flash")
866
861
sage: a.show(format="matroska")
867
862
sage: a.show(format="avi")
@@ -956,10 +951,10 @@ def ffmpeg(self, savefile=None, show_path=False, output_format=None,
956
951
....: for k in srange(0, 2*pi, 0.7)],
957
952
....: xmin=0, xmax=2*pi, ymin=-1, ymax=1, figsize=[2,1])
958
953
sage: td = tmp_dir()
959
- sage: a.ffmpeg(savefile=td + 'new.mpg') # long time # optional -- ffmpeg
960
- sage: a.ffmpeg(savefile=td + 'new.avi') # long time # optional -- ffmpeg
961
- sage: a.ffmpeg(savefile=td + 'new.gif') # long time # optional -- ffmpeg
962
- sage: a.ffmpeg(savefile=td + 'new.mpg', show_path=True) # long time # optional -- ffmpeg
954
+ sage: a.ffmpeg(savefile=td + 'new.mpg') # long time # optional -- FFmpeg
955
+ sage: a.ffmpeg(savefile=td + 'new.avi') # long time # optional -- FFmpeg
956
+ sage: a.ffmpeg(savefile=td + 'new.gif') # long time # optional -- FFmpeg
957
+ sage: a.ffmpeg(savefile=td + 'new.mpg', show_path=True) # long time # optional -- FFmpeg
963
958
Animation saved to .../new.mpg.
964
959
965
960
.. NOTE::
@@ -973,7 +968,7 @@ def ffmpeg(self, savefile=None, show_path=False, output_format=None,
973
968
974
969
TESTS::
975
970
976
- sage: a.ffmpeg(output_format='gif',delay=30,iterations=5) # long time # optional -- ffmpeg
971
+ sage: a.ffmpeg(output_format='gif',delay=30,iterations=5) # long time # optional -- FFmpeg
977
972
"""
978
973
from sage .features .ffmpeg import FFmpeg
979
974
FFmpeg ().require ()
@@ -1152,7 +1147,7 @@ def save(self, filename=None, show_path=False, use_ffmpeg=False, **kwds):
1152
1147
sage: a.save(td + 'wave.gif') # long time # optional -- ImageMagick
1153
1148
sage: a.save(td + 'wave.gif', show_path=True) # long time # optional -- ImageMagick
1154
1149
Animation saved to file .../wave.gif.
1155
- sage: a.save(td + 'wave.avi', show_path=True) # long time # optional -- ffmpeg
1150
+ sage: a.save(td + 'wave.avi', show_path=True) # long time # optional -- FFmpeg
1156
1151
Animation saved to file .../wave.avi.
1157
1152
sage: a.save(td + 'wave0.sobj')
1158
1153
sage: a.save(td + 'wave1.sobj', show_path=True)
@@ -1166,7 +1161,7 @@ def save(self, filename=None, show_path=False, use_ffmpeg=False, **kwds):
1166
1161
Ensure that we can pass delay and iteration count to the saved
1167
1162
GIF image (see :trac:`18176`)::
1168
1163
1169
- sage: # long time, optional - imagemagick
1164
+ sage: # long time, optional -- ImageMagick
1170
1165
sage: a.save(td + 'wave.gif')
1171
1166
sage: with open(td + 'wave.gif', 'rb') as f:
1172
1167
....: print(b'GIF8' in f.read())
0 commit comments