hi dan,
thanks for this script (and for all the others i could find here)!
i’m trying to combine this one with another script by you but i can’t get it to work.
it only works with the last condition.
i want a comp to play at random intervals but also want it to play when i activate it manually via checkbox.
i guess it must have sth to do with how the keyframes are held,
but when i remove the first part of the second condition and leave it like this:
if (chkBx.value == 1){
n = chkBx.nearestKey(time).index;
if (chkBx.key(n).time > time) n–;
time – chkBx.key(n).time;
}
… nothing will change…
i’m not that much into expressions, so i’d be thankful if you could help me out a bit!
thanks in advance,
-cris
//============================================
//if activated, play comp at random intervals.
//============================================
minDur = 1;
maxDur = 2;
randChkBx = comp("xxx").layer("xx").effect("playRandom")("Kontrollkästchen");
if (randChkBx.value == 1){
seedRandom(index,true);
t0 = inPoint + random(maxDur);
t1 = t0 + random(minDur,maxDur);
while(t1 < time){
t0 = t1;
t1 = t0 + random(minDur,maxDur);
}
t = time - t0;
} else {
value
}
//============================================
//if activated, play comp, else hold on 0.
//============================================
chkBx = comp("xxx").layer("xx").effect("playNow")("Kontrollkästchen");
if (chkBx.value == 0){
0
}else if (chkBx.numKeys == 0){
time
}else{
n = chkBx.nearestKey(time).index;
if (chkBx.key(n).time > time) n--;
time - chkBx.key(n).time;
}