Function Repository Resource:

TextChangeAnimation

Source Notebook

Create an animation of text changing

Contributed by: Bob Sandheinrich

ResourceFunction["TextChangeAnimation"][str1,str2,n]

gives an animation of text str1 changing into str2 in n steps.

ResourceFunction["TextChangeAnimation"][str1,str2]

uses 10 steps.

Details and Options

ResourceFunction["TextChangeAnimation"] accepts the options of both ListAnimate and Graphics as well as the following:
"TextStyle"16Style specification for the text
"AnimationFunction"ListAnimatefunction to use for animation
Values for "AnimationFunction" must accept the same inputs and options as ListAnimate.
The text is converted to lowercase.
Characters from str2 that are not in str1 come from the outside.
Characters from str1 that are not in str2 go to the outside.

Examples

Basic Examples (1) 

Create a text change animation:

In[1]:=
ResourceFunction[
 "TextChangeAnimation"]["turn this text", "into something else"]
Out[1]=

Scope (1) 

Create only four frames:

In[2]:=
ResourceFunction[
 "TextChangeAnimation"]["turn this text", "into something else", 4]
Out[2]=

Options (4) 

TextStyle (1) 

Specify the text style:

In[3]:=
ResourceFunction[
 "TextChangeAnimation"]["this is purple", "it is also large", "TextStyle" -> Directive[32, Purple, FontFamily -> "Source Code Pro"]]
Out[3]=

AnimationFunction (1) 

Use the SimpleListAnimate resource function to create the animation:

In[4]:=
ResourceFunction[
 "TextChangeAnimation"]["this is purple", "it is also large", "AnimationFunction" -> ResourceFunction["SimpleListAnimate"]]
Out[4]=

Graphics Options (1) 

Specify the style of the background:

In[5]:=
ResourceFunction[
 "TextChangeAnimation"]["radical contrast", "creates drama", "TextStyle" -> Directive[16, White], Background -> Black]
Out[5]=

ListAnimate Options (1) 

Specify the animation direction:

In[6]:=
ResourceFunction[
 "TextChangeAnimation"]["goes forward", "backward too", AnimationDirection -> ForwardBackward]
Out[6]=

Properties and Relations (2) 

Get the frames:

In[7]:=
Cases[ResourceFunction["TextChangeAnimation"]["turn this text", "into something else"], _Graphics, 10]
Out[7]=

Create just three frames:

In[8]:=
Cases[ResourceFunction["TextChangeAnimation"]["turn this text", "into something else", 3], _Graphics, 10]
Out[8]=

Version History

  • 1.0.0 – 30 June 2020

Related Resources

License Information