Hey, this is my expression.
if(thisLayer.effect("ADBE LIQUIFY")("Distortion Mesh").key(1).value==thisLayer.effect("ADBE LIQUIFY")("Distortion Mesh").value)
{
0;
}else{
5;
}
Currently, it switches from 0 to 5 (and opposite) instantly. What I want to do is make it switch slowly. 0 to 5 in half second for example.
For a smooth transistion, you need linear() or ease() function.
The key to both is a useable time-value and there are several ways to get one - however, we need more details for a better answer.
You can read-out a given time-point (a marker, a keyframe, in- or out-point of a layer) and use this as trigger.
For example:
tstart = key(1).time
tend = tstart + 0.5 // half a second
linear(time, tstart, tend, value1, value2)
Trigger is the time position of the first keyframe.
You can read out the time-point dynamically. There are several ways from iterating through all keyframes and find the fitting one (fitting is defined by your own conditions), or use the built-in function nearestKey() (which will switch to the next key automatically, when this key is closer to the CTI than the previous one - this behaviour can be unwanted, for example, if keyframes are close together an the transistion isn't finished yet).
You can also make this completly autopilot. You can iterate through all frames (starting from 0 and going forward, as well as starting from current time and going backward/forward) and check a value of your choice at this time-point againt the trigger-value.
for (i = 0, i <= time, i+oneFrameInSeconds){
if (someLayer.opacity == 45){
tstart = i
tend = tstart + 0.5
linear(...)
break
However, such an expression is a heavy loader (I use to call this the Doom-Loop), because it iterates all frames for every frame. The longer your comp is (the later your trigger value appears), the more iterations necassary and the slower everything will be.
*Martin