I think I might be missing a trick here, mainly I as I’m pretty new at expressions. Just the rewritten code based on your decaying method but I’m getting errors back. Obviously if the value is above 10 then I want it to activate the loop cycle.
Thoughts gratefully recieved 🙂
threshold = 10.0;
Bod = thisComp.layer(“Body”).transform.position.speed;
below = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (below){
if (Bod.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (Bod.valueAtTime(t) >= threshold){
below = true;
}
if (frame == 0){
break;
}
frame–
}
if (! below){
t = 0;
}else{
t = time – frame * thisComp.frameDuration;
}
loopOut(“pingpong”)
threshold = 10.0;
Bod = thisComp.layer("Body").transform.position.speed;
below = false;
frame = Math.round(time / thisComp.frameDuration);
while (true){
t = frame * thisComp.frameDuration;
if (below){
if (Bod.valueAtTime(t) < threshold){
frame++;
break;
}
}else if (Bod.valueAtTime(t) >= threshold){
below = true;
}
if (frame == 0){
break;
}
frame--
}
if (! below){
t = 0;
}else{
t = time - frame * thisComp.frameDuration;
}
loopOut("pingpong")