Forum Replies Created

Page 104 of 1081
  • Dan Ebberts

    November 16, 2021 at 6:08 pm in reply to: Position value as target of automatized movements

    Something like this maybe:

    dur = 1.0;

    val = value;

    if (numKeys > 0){

    n = nearestKey(time).index;

    if (time > key(n).time) n++;

    if (n <= numKeys){

    v1 = n == 1 ? valueAtTime(0) : key(n-1).value;

    v2 = key(n).value;

    t1 = key(n).time-dur;

    t2 = key(n).time;

    val = ease(time,t1,t2,v1,v2);

    }else{

    val = key(numKeys).value;

    }

    }

    val

  • If you have the images in a sequence, one image per frame, then you could use a time remapping expression to control which frame is displayed based on some calculation for which page is currently flipping. Then you could, for example, use layer markers to advance to the next frame/page with a time remapping expression like this:

    m = marker;

    n = 0;

    if (m.numKeys > 0){

    n = m.nearestKey(time).index;

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

    }

    framesToTime(n)

  • Dan Ebberts

    November 15, 2021 at 2:12 pm in reply to: Position value as target of automatized movements

    I see a couple of things. This line:

    if (CurrentKeyframe.index = 1) {

    needs to be like this:

    if (CurrentKeyframe.index == 1) {

    Also, your code doesn’t quite work if there are no keyframes (or only one keyframe) or if the first keyframe might be later than time = 0. I think something like this should work for what you’re trying to do:

    val = value;

    if (numKeys > 1){

    n = nearestKey(time).index;

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

    if (n == 1){

    t1 = key(1).time;

    t2 = key(2).time;

    v1 = key(1).value;

    v2 = key(2).value;

    val = ease(time,t1,t2,v1,v2);

    }

    }

    val

  • Dan Ebberts

    November 15, 2021 at 1:48 pm in reply to: for() if(){}

    I haven’t tested this, but I think you’d want to structure it more like this:

    val = "No Match";

    for (var k=0; k<21; k++){

    if(footage("daily-by-location.json").dataValue([1,k,8])=="618f344d1cb3e06d152fd4b3″){

    val = footage("daily-by-location.json").dataValue([1,k,4]);

    break;

    }

    }

    val

  • Dan Ebberts

    November 12, 2021 at 6:46 pm in reply to: cycle out expression where y position value is added?

    I think what you want is the “offset” flavor of loopOut(). You probably only need the first 3 keyframes:

    loopOut("offset")
  • There are some situations where you might need a different approach. For example, if the y position of the 1st and 2nd keyframes are the same (and maybe the y value goes above and/or below the keyframe value in between). In that case you might want to proportion the y offset, based on how far along you are between the two keyframes, like this:

    dropMenu = effect("Dropdown Menu Control")("Menu");

    myListe = [195.7, 258.2, 320.7, 445.7, 508.2, 570.7, 633.2, 695.7, 758.2, 820.7, 883.2];

    myPlace = myListe[dropMenu - 1];

    t1 = key(1).time;

    t2 = key(2).time;

    yOffset = linear(time,t1,t2,0,myPlace)

    value + [0,yOffset]

  • The nested comp with offset start time stuff is always tricky, but it will probably look something like this:

    C = comp("Main");

    L1 = C.layer("Null 1");

    L2 = C.layer(thisComp.name);

    L2.fromComp(L1.toComp(L1.anchorPoint,time+L2.startTime));

  • Dan Ebberts

    November 4, 2021 at 10:03 pm in reply to: Move layer x pixels every nn frames and then stop

    I guess that would look like this:

    tStep = framesToTime(10);

    tPause = framesToTime(10);

    tStart = framesToTime(10);

    tStop = framesToTime(300);

    jumpY = -200;

    t = Math.min(Math.max(time - tStart,0),tStop);

    nSteps = Math.floor(t/(tStep+tPause));

    phase = t-((tStep+tPause)*nSteps);

    e = linear(phase,0,tStep,0,jumpY);

    value + [0,nSteps*jumpY + e]

  • Dan Ebberts

    November 4, 2021 at 7:09 pm in reply to: Triggering Animation with SoundKeys

    Not fully tested, but maybe something like this:

    beat = 5; // which beat to trigger on

    threshold = 20.0;

    audioLev = thisComp.layer("soundKeys Average").effect("Sound Keys")("Output 1");

    above = false;

    fCur = timeToFrames(time);

    f = 0

    fSave = [];

    n = 0;

    while (f <= fCur){

    t = framesToTime(f);

    if (above){

    if (audioLev.valueAtTime(t) < threshold){

    above = false;

    }

    }else if (audioLev.valueAtTime(t) >= threshold){

    above = true;

    n++;

    fSave.push(f);

    }

    f++;

    }

    (n >= beat) ? time - framesToTime(fSave[beat-1]) : 0

  • Dan Ebberts

    November 3, 2021 at 6:51 pm in reply to: Move layer x pixels every nn frames and then stop

    Like this (adjust tStart to set start frame):

    tStep = framesToTime(10);

    tPause = framesToTime(10);

    tStart = framesToTime(10);

    tStop = framesToTime(300);

    jumpX = -200;

    t = Math.min(Math.max(time - tStart,0),tStop);

    nSteps = Math.floor(t/(tStep+tPause));

    phase = t-((tStep+tPause)*nSteps);

    e = linear(phase,0,tStep,0,jumpX);

    value + [nSteps*jumpX + e,0]

Page 104 of 1081

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