Forum Replies Created

Page 103 of 1081
  • I’m not sure how long the sequence is supposed to be, but something like this maybe:

    posterizeTime(4)

    options = [[240, 80, 233, 255], [73, 215, 0, 255], [233, 207, 202, 255], [0, 135, 202, 255]];

    r = (time < .25 || time >= outPoint - .25) ? 0 : Math.floor(random(4));

    options[r]/255;

  • Something like this would be more compact, I think:

    n = 14;

    result = 0;

    for (i = 1; i <= n; i++){

    if (thisComp.layer(index+i).effect("First Word")("Checkbox").value){

    result = i;

    break;

    }

    }

    result

  • Dan Ebberts

    November 30, 2021 at 4:39 pm in reply to: Text changes to the text of the next text line

    Something like this maybe:

    txt = value.split("\r");

    f = timeToFrames(time);

    idx = Math.min(f,txt.length-1);

    txt[idx]

  • Maybe change this line:

    r = Math.floor(random(4));

    to this:

    r = time < .25 ? 0 : Math.floor(random(4));

  • Dan Ebberts

    November 25, 2021 at 12:54 am in reply to: timeRemap play

    The basic idea is the same as described here, but instead of audio level, you’re dealing with a different type of value:

    http://www.motionscript.com/design-guide/audio-trigger.html

  • Dan Ebberts

    November 24, 2021 at 8:55 pm in reply to: timeRemap play

    I’m still pretty much in the dark as to what you’re trying to do, but a time remapping expression like this will cause your time remapped animation to run from the beginning whenever a layer marker is encountered:

    m = marker;

    t = 0;

    if (m.numKeys > 0){

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) n--;

    t = n > 0 ? time - m.key(n).time : 0;

    }

    t

  • Dan Ebberts

    November 23, 2021 at 11:17 pm in reply to: timeRemap play

    For an expression to trigger an animation based on an event, the biggest issue for the expression is generally determining when that event occurred. If you can tie it to keyframes or markers, it becomes simpler, but if it’s based on a value, then you probably have use the brute force method of going back in time (using valueAtTime), frame by frame, until you find the frame where (in your example) s went from being zero to being greater than zero. Once you have that, you can calculate how far along you should be in the animation.

    You can improve performance if the expression knows the duration of the animation. That way you can limit how far back in time you have to look for a trigger. BTW, what happens at the end of your animation? Does it return to the frame 0 state?

  • Assuming you have the Change to Color’s From parameter set to the original color, you could do something like this:

    colors = [[36,244,246,255], [169,36,246,255],[246,234,36,255]]; // alternate colors

    dur = 1; // how often to change colors

    seed = Math.floor(time/dur);

    seedRandom(seed,true);

    idx = Math.floor(random(colors.length +1));

    idx < colors.length ? colors[idx]/255 : effect("Change to Color")("From")

  • Dan Ebberts

    November 18, 2021 at 10:27 pm in reply to: layer index of parent comp

    The only way to reference another comp (parent or otherwise) is by name. Sometimes, depending on how you have things set up, you might be able to build the name of the other comp on the fly, based on the name of the precomp where the expression lives.

    Dan

  • Dan Ebberts

    November 17, 2021 at 4:40 pm in reply to: Source Text Repeat Expression

    This should work, as long as you’re using the JavaScript expression engine:

    compName = thisComp.name;

    compName.substring(compName.indexOf('-')+2).repeat(3)

Page 103 of 1081

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy