Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Generate a function that displays graphical objects at successive times
ResourceFunction["EvolutionViewFunction"][imgs] generates a function representing a time-evolving succession of graphical objects imgs. | |
ResourceFunction["EvolutionViewFunction"][imgs,mode] shows successive objects according to mode. | |
ResourceFunction["EvolutionViewFunction"][imgs,mode,times] shows objects at times specified by times. | |
ResourceFunction["EvolutionViewFunction"][imgs,mode,times,pos] places the origin of the sequence of objects at pos. |
first stage | at first, an initial subsequence of objects is shown, whose form is determined by mode |
mid-stages | a sequence of stages that implement the actual time evolution, each of which consists of six sub-stages |
last stage | at last, the final subsequence of objects is shown, whose form is determined by mode |
emerge | new elements appear in the subsequence currently shown |
wait1 | after the emerge phase is finished, the elements are kept fixed |
fadeaway | then some of the older elements fade away |
wait2 | after the fadeaway phase is finished, the remaining elements are kept fixed |
move | the remaining elements are moved aside to make space for new elements that are to emerge in the next sub-stage |
wait3 | after the move phase is finished, the remaining elements are kept fixed |
"Increase" | increase successively the number of elements shown until their number reaches the maximum default value; then update elements but keep their number constant (default) |
"Decrease" | start with the sequence of the maximum number of elements and then decrease their number until a single element remains |
"IncreaseDecrease" | at first increase the number of elements; then keep their number constant; at the end decrease their number to a single element |
"Continue" | like "IncreaseDecrease" but the decreasing stage of the sequence is aligned to the opposite side |
"Constant" | keep the number of elements shown constant |
"OneByOne" | show only a single element at a time |
{mode,maxnum} | specify mode as well as the maximum number maxnum of elements shown (set to 2 by default); when maxnum is set to 1, the mode is automatically switched to "OneByOne" |
Automatic | each sub-stage lasts 1 unit of time (default) |
dur | each sub-stage lasts dur units of time |
{durem,durw1,durfade,durw2,durmove,durw3} | specify duration of each sub-stage |
{{durem1,…},{durem2,…},…} | specify duration of each sub-stage for each mid-stage separately |
{dursmid,{durfirst,durlast}} | specify durations dursmid for mid-stages using the above-mentioned formats and also separately set the duration of the first stage dursfirst and the last stage durlast |
{dursmid,dursfirstlast,timestamps} | specify also absolute timestamps for the start of each mid-stage as well as the last stage |
{Automatic,Automatic,timestamps} | specify only the timestamps |
Alignment | Right | alignment of the sequence with respect to the pos |
Direction | Left | direction of movement of elements |
Dividers | Automatic | graphical object inserted between each two successive elements |
ItemSize | 0.5 | size of each graphical object |
RotateLabel | {True,π} | whether to rotate graphical objects depending on Direction |
Spacings | 1 | spacing between the centers of each two successive elements |
Verbose | False | whether to return the summary Association |
"EmergeFunction" | Automatic | function applied to new elements |
"FadeFunction" | Automatic | function applied to old elements |
"NormalizeTimes" | False | whether to normalize the total duration of the sequence |
Right | sequence aligned to the right (default) |
Left | sequence aligned to the left |
Center | sequence aligned to the center |
Top | sequence aligned vertically to the top |
Bottom | sequence aligned vertically to the bottom |
None | no alignment applied |
{hor,ver} | horizontal alignment hor, which can be set to Right,Left or Center, and vertical alignment ver, which can be set to Top,Bottom or Center |
{hor,ver,rel} | specify also the relative alignment of elements within the sequence, possible values are Right,Left and Center |
Left | move elements to the left (default) |
Right | move elements to the right |
Up | move elements upward |
Down | move elements downward |
ang | move elements along a line that subtends an angle ang with respect to the positive x-axis |
{x,y} | move elements along a vector {x,y} |
True | rotate both the elements and the dividers based on the setting of Direction |
False | do not rotate anything |
{rotelems,rotdivs} | whether to rotate elements and dividers is specified by rotelems and rotdivs, respectively |
{rot,addang} | rotate both elements and dividers and add a constant angle offset of addang (default is {True,π}) |
{{rot,addang}} | the same as above |
{{rotelems,addangelems},{rotdivs,addangdivs}} | specify the rotation and the constant angle offset for elements and dividers separately |
Automatic | new objects slowly emerge (default) |
None | new objects appear immediately |
fun | function fun is applied to each new object |
{funfirst,funrest} | function funfirst is applied to the sequence of elements at the very beginning of the evolution and then function funrest is applied to each new object |
Automatic | new objects slowly fade away (default) |
None | new objects disappear immediately |
fun | function fun is applied to each object that is to be disposed of |
{funmost,funlast} | function funmost is applied to old elements in the course of the evolution and then function funlast is applied to the remaining sequence of objects |
Create a simple animation where one colored image follows another:
In[1]:= | ![]() |
Out[2]= | ![]() |
Represent a sequence of plots in time:
In[3]:= | ![]() |
Out[4]= | ![]() |
Create a Tetris-like effect:
In[5]:= | ![]() |
Out[78]= | ![]() |
The graphical objects may be images:
In[79]:= | ![]() |
Out[81]= | ![]() |
They may also be Graphics objects:
In[82]:= | ![]() |
Out[83]= | ![]() |
The head Graphics may be omitted:
In[84]:= | ![]() |
Out[86]= | ![]() |
The default mode:
In[87]:= | ![]() |
Out[88]= | ![]() |
Use mode "Increase" with at most four images shown at a time:
In[89]:= | ![]() |
Out[90]= | ![]() |
Do not restrict the maximum number of images shown:
In[91]:= | ![]() |
Out[92]= | ![]() |
Use the default number:
In[93]:= | ![]() |
Out[94]= | ![]() |
Mode "Increase" increases the number of shown images from one to a given maximum number:
In[95]:= | ![]() |
Out[96]= | ![]() |
Mode "IncreaseDecrease" increases the number of shown images from one to a given maximum number and then decreases it again to one:
In[97]:= | ![]() |
Out[98]= | ![]() |
When the maximum specified number is too large, it is automatically adjusted:
In[99]:= | ![]() |
Out[100]= | ![]() |
Mode "Continue" works similar to "IncreaseDecrease" but the images in the decreasing part are aligned to the opposite side:
In[101]:= | ![]() |
Out[102]= | ![]() |
Mode "Decrease" works similar to "Increase" but the number of images decreases:
In[103]:= | ![]() |
Out[104]= | ![]() |
Mode "Constant" keeps the number of images constant:
In[105]:= | ![]() |
Out[106]= | ![]() |
Mode "OneByOne" shows always only a single image at a time:
In[107]:= | ![]() |
Out[108]= | ![]() |
This mode is used automatically whenever the maximum specified number is set to 1 for any of the other modes:
In[109]:= | ![]() |
Out[110]= | ![]() |
Specify the time duration of each step of the animation:
In[111]:= | ![]() |
Out[112]= | ![]() |
By default, the total time duration is set to 1; turn the normalization off:
In[113]:= | ![]() |
Out[114]= | ![]() |
Total duration can be read out by setting Verbose to True:
In[115]:= | ![]() |
Out[115]= | ![]() |
Set different durations for each sub-stage:
In[116]:= | ![]() |
Get corresponding timestamps:
In[117]:= | ![]() |
Out[118]= | ![]() |
Show the evolution and timestamps:
In[119]:= | ![]() |
Out[119]= | ![]() |
Durations can be specified for each mid-stage independently:
In[120]:= | ![]() |
The number of mid-stages is given in "Number of mid stages" field of the summary Association:
In[121]:= | ![]() |
Out[121]= | ![]() |
This number is calculated automatically and can be read out also when no explicit time specification is given:
In[122]:= | ![]() |
Out[122]= | ![]() |
Durations of the very first and very last stage of the animation can be set separately from the rest:
In[123]:= | ![]() |
Out[124]= | ![]() |
By default, the total duration is normalized to one and so the final durations might be different from the input values:
In[125]:= | ![]() |
Out[125]= | ![]() |
Set explicit timestamps that specify the beginning of each mid-stage:
In[126]:= | ![]() |
Out[127]= | ![]() |
The beginning of the animation is determined from the duration of the first stage:
In[128]:= | ![]() |
Out[129]= | ![]() |
The end of the animation is determined from the duration of the last stage:
In[130]:= | ![]() |
Out[131]= | ![]() |
When absolute timestamps are used, the durations of individual sub-stages are rescaled to fit:
In[132]:= | ![]() |
Out[133]= | ![]() |
In[134]:= | ![]() |
Out[135]= | ![]() |
Compare with the animation itself:
In[136]:= | ![]() |
Out[136]= | ![]() |
Place the origin of the emerging images at a given point:
In[137]:= | ![]() |
Out[138]= | ![]() |
Turn off the slow-emerge effect for new images:
In[139]:= | ![]() |
Out[140]= | ![]() |
Specify a custom function:
In[141]:= | ![]() |
Out[142]= | ![]() |
Specify different "EmergeFunction" for the very first stage and the rest:
In[143]:= | ![]() |
Out[144]= | ![]() |
Turn off the slow-fade-away effect for old images:
In[145]:= | ![]() |
Out[146]= | ![]() |
Specify a custom function:
In[147]:= | ![]() |
Out[148]= | ![]() |
Specify different "FadeFunction" for the very last stage and the rest:
In[149]:= | ![]() |
Out[150]= | ![]() |
By default, the time intervals are normalized such that the total duration of animation is 1:
In[151]:= | ![]() |
Out[152]= | ![]() |
Set "NormalizeTimes" to False to turn off the normalization:
In[153]:= | ![]() |
Out[154]= | ![]() |
The total duration of the animation can be obtained by setting Verbose to True:
In[155]:= | ![]() |
Out[155]= | ![]() |
When explicit timestamps are used, the value of "NormalizeTimes" is ignored:
In[156]:= | ![]() |
Out[157]= | ![]() |
The total duration:
In[158]:= | ![]() |
Out[158]= | ![]() |
Summary of different internal parameters can be displayed by setting Verbose to True:
In[159]:= | ![]() |
Out[160]= | ![]() |
For precise synchronization with other animated elements, "Timestamps for mid stages" and "Time specification" are especially relevant:
In[161]:= | ![]() |
Out[161]= | ![]() |
In[162]:= | ![]() |
Out[162]= | ![]() |
In[163]:= | ![]() |
Out[163]= | ![]() |
The latter can be plugged back into EvolutionViewFunction as the time specification and then manually modified:
In[164]:= | ![]() |
The new function has the last fade-away stage a little longer:
In[165]:= | ![]() |
Out[165]= | ![]() |
Turn off the default dividers:
In[166]:= | ![]() |
Out[167]= | ![]() |
Use custom dividers:
In[168]:= | ![]() |
Out[169]= | ![]() |
By default, images as well as dividers are rotated according to the direction of movement:
In[170]:= | ![]() |
Out[171]= | ![]() |
Set the spacings between the centers of graphical objects:
In[172]:= | ![]() |
Out[173]= | ![]() |
The Spacings value always refers to the spacing in the direction specified by Direction:
In[174]:= | ![]() |
Out[175]= | ![]() |
Adjust the size of images:
In[176]:= | ![]() |
Out[177]= | ![]() |
In[178]:= | ![]() |
Out[179]= | ![]() |
The value of ItemSize is used only when the images are specified as explicit Image, Graphics, or Graphics3D objects:
In[180]:= | ![]() |
Out[181]= | ![]() |
In[182]:= | ![]() |
Out[183]= | ![]() |
The same holds true for dividers:
In[184]:= | ![]() |
Out[185]= | ![]() |
In[186]:= | ![]() |
Out[187]= | ![]() |
Specify the horizontal alignment:
In[188]:= | ![]() |
Out[189]= | ![]() |
Specify the vertical alignment:
In[190]:= | ![]() |
Out[191]= | ![]() |
Specify both the horizontal and vertical alignment:
In[192]:= | ![]() |
Out[193]= | ![]() |
Center the objects:
In[194]:= | ![]() |
Out[195]= | ![]() |
Specify the horizontal direction in which the sliding objects move:
In[196]:= | ![]() |
Out[197]= | ![]() |
Specify the vertical direction:
In[198]:= | ![]() |
Out[199]= | ![]() |
An arbitrary direction can be given:
In[200]:= | ![]() |
Out[201]= | ![]() |
Create a progress indicator:
In[202]:= | ![]() |
Out[203]= | ![]() |
Create a graphical representation of a countdown:
In[204]:= | ![]() |
Out[205]= | ![]() |
Annotate individual stages of a drawing process:
In[206]:= | ![]() |
Out[207]= | ![]() |
In[208]:= | ![]() |
Out[209]= | ![]() |
When no explicit PlotRange for Graphics is specified, unexpected behavior occurs:
In[211]:= | ![]() |
Out[212]= | ![]() |
Specify PlotRange explicitly:
In[213]:= | ![]() |
Out[213]= | ![]() |
When no color setting is given, the default fade and emerge functions do not work:
In[214]:= | ![]() |
Out[215]= | ![]() |
Specify color explicitly:
In[216]:= | ![]() |
Out[217]= | ![]() |
When explicit timestamps are used, the option "NormalizeTimes" is ignored:
In[218]:= | ![]() |
Out[219]= | ![]() |
The time span of the latter function is 5 in this case:
In[220]:= | ![]() |
Out[220]= | ![]() |
Compare with the default setting:
In[221]:= | ![]() |
Out[222]= | ![]() |
When the option Verbose is set to True, the output is not a function but an Association containing a parameter summary:
In[223]:= | ![]() |
Out[224]= | ![]() |
In[225]:= | ![]() |
Out[226]= | ![]() |
In[227]:= | ![]() |
Out[227]= | ![]() |
To improve formatting, some parameters in the summary Association are wrapped in HoldForm:
In[228]:= | ![]() |
Out[229]= | ![]() |
In[230]:= | ![]() |
Out[230]= | ![]() |
Use ReleaseHold to get the actual values:
In[231]:= | ![]() |
Out[231]= | ![]() |
For some cases, the second argument for functions in "EmergeFunction" and "FadeFunction" should be conditioned by NumericQ:
In[232]:= | ![]() |
In[233]:= | ![]() |
The second argument for functions in "FadeFunction" is automatically reversed and so the same functions can be supplied to "EmergeFunction" as well as "FadeFunction":
In[234]:= | ![]() |
Out[235]= | ![]() |
In[236]:= | ![]() |
Out[237]= | ![]() |
Define Translate instead of fade-away-like functions for emergence and fading:
In[238]:= | ![]() |
Get the time evolution as well as timing information:
In[239]:= | ![]() |
Synchronize different parts of the scene:
In[240]:= | ![]() |
Play the animation:
In[241]:= | ![]() |
Out[241]= | ![]() |
Specify lines (create additional nodes by click):
In[242]:= | ![]() |
Out[243]= | ![]() |
Get evolution functions:
In[244]:= | ![]() |
Get times:
In[245]:= | ![]() |
Play the animation:
In[246]:= | ![]() |
Out[247]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License