Tracking Curves
From Synfig Studio :: Documentation
Introduction
http://uk.youtube.com/watch?v=wJ7C-FcxAy0 shows an example of a layer following a moving curve, and rotating to follow the curve as it moves.
How was that achieved? It's currently complicated to set up, so I'll describe here how it works. Hopefully a better design can be used to make it a lot more intuitive in Studio.
Details
The animation lasts for 32 seconds and has 3 layers:
- moving blob - an encapsulation of 3 layers. its origin is connected to the exported valuenode "moving point"
- direction of movement - the fuzzy white beam of light
- inner circle - the smaller yellow circle. not animated at all.
- outer circle - the larger red circle. not animated at all.
- line - the moving curve which the object follows. has waypoints at 0s, 16s, and 32s to make the line move. uses 4 exported animated valuenodes:
- vertex1 - the position of the beginning of the curve
- vertex2 - the position of the end of the curve
- tangent1 - the tangent at the beginning of the curve
- tangent2 - the tangent at the end of the curve
- black background - a solid black background. not animated at all.
moving point
"moving point" is an exported valuenode of type "Segment Vertex". It has 2 components which determine the vertex that is used as its value:
- segment - the curve to follow, defined by vertex1, vertex2, tangent1, and tangent2, as exported from the 'line' layer above
- amount - a number ranging from 0 to 1, which indicates how far along the segment to go. 0 means "use vertex1" and 1 means "use vertex2". I want the point to travel along the curve sinusoidally, meaning it will travel fastest in the middle and slow to a momentary stop at either end. This makes the movement look smoother than using a linear movement. I called this valuenode "((sin(angle))/2+0.5)", since that is how its value is calculated. The sin() function returns a number between -1 and 1, and I want a value between 0 and 1, so I halve the sin() value, giving -0.5 to 0.5, then add 0.5 to it, giving 0 to 1. Consequently, this 'amount' value is the result of a subtraction, LHS-RHS:
- LHS - the left hand side of the subtraction. I called this valuenode "((sin(angle))/2). This will range from -0.5 to 0.5, and is the result of the 'sine' convert type, sin(Angle)*Amplitude:
- Angle - I called this "linearly changing angle". This is the constantly changing angle that drives the whole animation. Whenever the angle increases by 360 degrees, the output of sin(Angle) does one complete cycle from 0 -> 1 -> 0 -> -1 -> 0. The angle changes linearly, using the Linear convert type, which has 2 parameters:
- Rate - how many degrees per second to increase
- Offset - the value at time=0s
- Amplitude - this is used to scale the value. Since I want sin(Angle)/2, the value is a constant 0.5.
- Angle - I called this "linearly changing angle". This is the constantly changing angle that drives the whole animation. Whenever the angle increases by 360 degrees, the output of sin(Angle) does one complete cycle from 0 -> 1 -> 0 -> -1 -> 0. The angle changes linearly, using the Linear convert type, which has 2 parameters:
- RHS - the right hand side of the subtraction. I wanted to add 0.5 to sin(angle)/2, but synfig only offers subtraction, so I subtracted -0.5 instead, which is the same. Thus, RHS is a constant Real valuenode, with value -0.5
- LHS - the left hand side of the subtraction. I called this valuenode "((sin(angle))/2). This will range from -0.5 to 0.5, and is the result of the 'sine' convert type, sin(Angle)*Amplitude:
Language: |
English |