Time

time*value

time*100

 

The time expression allows you to affect the value of a property over time.

The beauty of this simple expression is the continual movement of a layer without the need to create any keyframes - whether you’re looking for a constant rotation, scale, positional move etc, this expression is what you need.

Whilst holding option on a mac, or ALT on a PC, click the stopwatch next to your desired property

  1. Type time*

  2. Enter a number e.g 100

    The number you input after time* is the number that the time will be multiplied by. It sounds confusing but let me explain:

    If we were to simply input time; as our expression, the value outputted would be exactly that, the amount of time passed.

For example, if you were to add time; to rotation, then the rotation would equal that of the time. 1 second = 1 degree

So essentially, the number you choose, is how many times you want to affect the property in 1 second.

Let’s use rotation as an example again: If we wanted the square to make one full rotation every second, then we would use the expression time*360 as one full rotation equals 360.

Let’s now add the expression in another example using position.

The principles are the same; we input a number that we want the position to be affected by every second. The position’s value is based on pixels, so we are choosing how many pixels we want our object to travel per second.

The example below uses the expression time*100 on the x position of our layer.

This means our layer will travel 100 pixels per 1 second.

Initial Value

The one issue with this time expression is that whatever property you use it on, the value will always begin at 0, regardless of the current value. This is because time always begins at 0.

For example, if you applied this expression to the position of an object, that objects position will now start at 0 and move from there according to the expression.

If you wanted the object to start at a different position and then have the expression applied, then we need to add an additional line into the expression:

t = time*100;

[value + t]

What we have done here is take our expression and add it to the value of the property. If you have input the x position value of 50, our objects position will now begin at 50.

Initial Value (scale)

Much like other expressions, the above only works when the property has only one value. If the property has two, for example scale, then an error will occur if the expression is applied.

To fix this error, we need to tweak the expression slightly.

t = time*100;

v = value[0] + t;

[v,v]

Firstly we need to specify which value we want to use. Putting [0] after value (value[0]) we have stated we want to use the first value. For scale, both values are commonly equal to one-another so this will work perfectly well, but if we wanted to use the second value as the starting point we would instead put [1] after value (value[1]).

Position

If applying the expression to a position (when x and y have not been separated), then again, we need to adjust the expression slightly.

t = time*100;

v = value[1] + t;

[value[0],v]

The above expression, when applied to the position of an object, will only apply to the y position. The x position will be defined by it’s inputted value. It will also take the initial value from the y position before applying the expression.

If you needed to affect the x position rather than the y, then the same expression can be used but with the [0] and [1] switched around along with the two final output values on the final line.

t = time*100;

v = value[0] + t;

[v,value[1]]

Previous
Previous

Wiggle

Next
Next

Loop