Nick Josevski shows in an article on his blog how to create type-on animations using SketchFlow Animations.
He also asks if anybody knows a different, maybe easier solution.
Here is a really simple, quick&dirty behavior sample that handles type-on animation for text blocks.
Here is how you would use it:
- Create a text block. Make its initial text empty
- Pick the TypeOnAction from the asset panel and drop it on the TextBlock.
- Select the action in the object tree and configure the properties:
- Set the desired text in the TypeOnText property
- Set the desired delay between characters (in seconds) in the IntervalInSeconds property
- Set up whatever trigger you like for the action.
Below the code of the sample. It is really simple:
- It declares two DependencyProperties for the text to use and the delay for typing
- It declares a dispatcher timer for the delayed “typing”
- In the Invoke() method, we set up the timer and start it
- There is a timer callback that sets the text in the TextBox
To run the sample, save the code in a file TypeOnAction.cs and add it to your project. You might want to change the name space to match your project as well. After you build, you will find the new action in your asset panel.
Let me know what you think…