**Tweening/Morphing** effects are often used in Computer Animations to change the shape of an object by morphing an object from one shape into another.

In tweening, **key frames** are provided and **“in-between” frames** are calculated to make a smooth looking animation.

In this blog post we will implement a tweening algorithm to morph a letter of the alphabet (e.g. “A” into another letter “Z”) using a **linear interpolation**.

We will consider a letter as being a list of connected nodes (dots) where each dot has its own set of **(x,y) coordinates**.

#### Linear Interpolation Formulas:

Using the following **linear interpolation formulas** we can calculate the (x,y) coordinates of each dot for any “in-between” frame.

_{A}+ (x

_{Z}– x

_{A}) * t / 10

_{A}+ (y

_{Z}– y

_{A}) * t / 10

- “t” represents the time: in other words the frame number (e.g. between 0 and 10)
- (x
_{A},y_{A}) the coordinates of a node/dot from the starting letter (e.g. A) - (x
_{Z},y_{Z}) the coordinates of a node/dot from the ending letter (e.g. Z)

Using these formulas we can see that:

_{A}

y(0) = y

_{A}

_{Z}

y(10) = y

_{Z}

Our tweening algorithm will need to apply these formulas to each node of the letter.

#### Python Code *(using Python Turtle)*

#### Your Task #1

Tweak this code to create a tweening animation going through all the letters of your firstname.

(e.g. J -> A -> M -> E -> S).

#### Your Task #2

Tweak this code to create an animated count down timer counting from 9 to 0.

(e.g. 9 -> 8 -> 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1 -> 0).

#### Solution...

The solution for this challenge is available to full members!Find out how to become a member:

➤ Members Area