Showing posts with label Synfig. Show all posts
Showing posts with label Synfig. Show all posts
Lusus

How To Make an Object Follow a Path In Synfig


Synfig Studio is open source software that is a great tool for beginners looking to make their first 2D animation, as well as more experienced animators. This tutorial will show how to make an object follow a path in Synfig and then how to animate it. Although similar tutorials are already available this one takes the time to explain each step clearly. Also, most other tutorials show the object following a looped path, whereas here we use one that is left open. The two processes are however very similar.

To follow this tutorial you will need a basic knowledge of Synfig, and the animation process. Click all images to view full size.

Draw The Path


1/  From the toolbox to the upper left of the Synfig screen select the Spline tool. For those familiar with many graphics programs the spline tool is very similar to the paths tool, and serves a similar purpose.


2/ With the spline tool roughly draw out the path. To change the direction of the path, click the left mouse button and an anchor point will be added. When you are finished, click on the Transform Tool from the top right of the Toolbox to stop the line following your cursor from the last anchor point.


3/  With the Transform tool left click on one of the anchor points and two handles will appear. Grab one one of the handles and drag it to change that section of the path into a curve. Transform all the anchor points to a smooth curve in the same way.

From the image above you will see the anchor points are orange, and the handles are yellow. If you need to you can reposition an anchor by grabbing it and dragging it to the new position.

Import An Object



4/ Its now time to import the object that will follow the path. Instead of importing an object you can create one in Synfig. Similar tutorials use an arrow to follow the path. If you want to do this draw the outline of an arrow with the spline tool, them fill it with colour. As I wanted an imported object to follow a path for a recent project, I decided I might as well import one here for this tutorial.


In the top left corner of the Synfig screen hit File > Import then navigate to the object on your hard drive. Select the object then click the Import button in the pop up window. The object will now be added to the canvas area, along with its handles. Do not move the object from its present position for now.

Add A Rotation Layer


5/ We now need to add a rotation layer for the object. The lower right of the Synfig screen shows the layers that make up the present animation. Right click on the imported object layer,then select New Layer > Transform > Rotate.  A Rotation layer will be added and handles for the layer will be visible in the canvas area.

Group the Object and Rotation Layer



6/ We want the rotation layer to only influence the imported object, so we'll group them. Select the object layer then hold down Ctrl on your keyboard and select the rotation layer. Click the right mouse button, and from the menu select Group Layer.


The Rotation and Object layers are now contained in a group folder, and if you click the arrow to the left of the group the contents will be shown.

Link Object And Rotation Layers To The Path


7/ Before you begin this part, move the object very slightly so it won't obscure the handles of the rotation layer later.

With the contents of the group folder visible, select the object layer, then then click on the objects' green anchor in the canvas area.


Hold down the Ctrl key and select the rotation layer. Now in the canvas area select the rotations' blue handle. The rotation layers' handles are simpler than the objects handles as it consists only of a green and blue anchor.



With the Ctrl key still held down select the Path layer. Release the Ctrl key and right click on the dotted line of the path, away from the handles. From the drop down menu that will appear select Link to Spline.

All the items are now linked, and the object should move to a position on the line. To further position the object drag the Rotation layers' handles to a position on the path, then drag the object to the same position. Use each items' green handle for this. To rotate the object use the objects' blue handle, rather than the rotation layers' blue handle. (This can be slightly confusing for those new to this process).

Animating The Object Along The Path


8/ Postition the rotation layer handles at the start point of the path, then postion the object to the same place.


Switch to animation mode by clicking the green figure icon below the lower right of the canvas area, so it turns red. The canvas area should now also be framed with a red box.


In the time line area drag the orange marker to the place you want to create the next keyframe. Move the rotation layer handles, and the object to the next part of the path, and the keyframes should be added to the time line. I find it best to add keyframes at the peaks of all the curves on the path, as well as the lower parts of the curves. Continue to this process until you reach the end of the path.

Don't forget you can control the rotation of the object with the blue handle. The rotation will be included as part of a keyframe. If you don't adjust the objects' rotation it will probably flip around a lot in the final animation (see example below).

To check your animation, drag the time line marker to the beginning of the timeline and hit play. You can also use the preview function. You may find the object flies away from the path during parts of the play back. Remove the keyframes where this happens and create new ones until you get a smooth flow along the path.

The timing of the object along the path can be adjusted by repositioning the keyframes on the timeline. Just drag them to the new position. If you reposition keyframes, make sure the objects' keyframes and rotation layers' keyframes occupy the same times along the timeline. For example, if the rotation layer has a keyframe at 1 second, the object should also have a keyframe at 1 second.

Once you are done creating the animation, hit File > Render to export it from Synfig and save it as a video file. This may take a while.

Your finished animation should look something like (hopefully better than) the example below.


If you would like to see what an object following a path looks like in practise, here's a snippet from a project I've been working on.


I hope this tutorial has been useful to you, and if so please 'like 'us and share, and we look forward to you coming back for more.
Read More