Forum Replies Created

Page 97 of 1081
  • Dan Ebberts

    February 24, 2022 at 6:22 pm in reply to: Question from the book 'The Power of Expressions'

    It gives you the same result. layer() is pretty flexible. You can give it a single argument which can be either the name or the index of the layer (which is what you did), or you can give it two arguments–first a layer object and then a relative index from that layer (which is what the book did).

  • Dan Ebberts

    February 24, 2022 at 8:01 am in reply to: Define a range of value for a position

    Like this maybe (note that I left “Nul 2” spelled the way you have it):

    x = thisComp.layer("Nul 2").transform.xPosition;

    if(x >= 959.9 && x <= 960.1){

    0;

    }else{

    20;

    }

  • Dan Ebberts

    February 24, 2022 at 7:54 am in reply to: How can I put 2 loop in 1 expression ?

    Like this, maybe:

    time < key(1).time ? loopIn("pingpong",1) : loopOut("pingpong",1)
  • Dan Ebberts

    February 23, 2022 at 11:57 pm in reply to: Y position oscillates between numbers with holds

    Try this:

    minHold = .25;

    maxHold = 1.5;

    rampTime = .2;

    rampAmount = 100;

    minRampMult = .75;

    maxRampMult = 1.25;

    t = tPrev = 0;

    rt = rampTime;

    ra = rampAmount;

    while (t <= time){

    seedRandom(t,true);

    hold = random(minHold,maxHold);

    rampMult = random(minRampMult,maxRampMult);

    rtPrev = rt;

    raPrev = ra;

    rt = rampTime*rampMult;

    ra = rampAmount*rampMult;

    period = rt*2 + hold;

    tPrev = t;

    t += period

    }

    deltaT = time - tPrev;

    if (deltaT < rtPrev)

    y = linear(deltaT,0,rtPrev,0,raPrev)

    else

    y = linear(deltaT,rtPrev,2*rtPrev,raPrev,0);

    value + [0,y]

  • Dan Ebberts

    February 22, 2022 at 10:04 pm in reply to: Y position oscillates between numbers with holds

    I’m not sure if this is what you’re after, but it might give you some ideas. Apply the expression to a layer’s position property and look at the result in the graph editor.

    minHold = .25;

    maxHold = 1.5;

    rampTime = .2;

    rampAmount = 100;

    t = tPrev = 0;

    while (t <= time){

    seedRandom(t,true);

    hold = random(minHold,maxHold);

    period = rampTime*2 + hold;

    tPrev = t;

    t += period

    }

    deltaT = time - tPrev;

    if (deltaT < rampTime)

    y = linear(deltaT,0,rampTime,0,rampAmount)

    else

    y = linear(deltaT,rampTime,2*rampTime,rampAmount,0);

    value + [0,y]

  • Like this maybe:

    tEase = 1;

    if (time < (inPoint + outPoint)/2)

    ease(time,inPoint,inPoint+tEase,value,value - [0,50])

    else

    ease(time,outPoint-tEase,outPoint,value - [0,50],value)

  • Dan Ebberts

    February 18, 2022 at 3:33 am in reply to: fade-in/out color based on input values

    There were a few typos in there, but I think this does what you descibe:

    var cti = timeToFrames();

    var tli = thisComp.layer("Controller").effect("TarLight 1 on")("Slider")

    var tlo = thisComp.layer("Controller").effect("TarLight 1 off")("Slider")

    var tli2 = thisComp.layer("Controller").effect("TarLight 2 on")("Slider")

    var tlo2 = thisComp.layer("Controller").effect("TarLight 2 off")("Slider")

    var frames = 1 / thisComp.frameDuration;

    var fadeFrames = thisComp.layer(1).effect("Fade Time")("Slider");

    var fadeTime =fadeFrames / frames;

    var st = tli / frames;

    var et = tlo / frames;

    var st2 = tli2 /frames;

    var et2 = tlo2 /frames;

    gray = [99, 102, 106, 255]/255

    blue = [3, 169, 244, 255]/255

    if (cti < tlo)

    ease(time, st, st - fadeTime, gray, blue)

    else if (cti < tlo + fadeFrames)

    ease(time, et, et + fadeTime, blue, gray)

    else if (cti < tlo2)

    ease(time, st2 - fadeTime, st2, gray, blue)

    else

    ease(time, et2, et2 + fadeTime, blue, gray);

  • Dan Ebberts

    February 17, 2022 at 6:45 pm in reply to: fade-in/out color based on input values

    You need to structure your if tests so that they’re in chronological order, otherwise, (in this case) you’ll never get past this one:

    else if (cti > tlo)

    I haven’t tested this, but you should be able to replace all your if/else stuff with something close to this:

    if (cti < tl0)

    ease(time, st, st - fadeTime, gray, blue)

    else if (cti < tlo + fadeTime)

    ease(time, et, et + fadeTime, blue, gray)

    else if (cti < tl02)

    ease(time, st2 - fadeTime, st2, gray, blue)

    else{

    ease(time, et2, et2 + fadeTime, blue, gray);

  • Dan Ebberts

    February 15, 2022 at 2:15 pm in reply to: finding layers in another comp and extracting values…

    I think the reason it doesn’t work is that you have it applied to a text layer’s source text property and this line:

    value*(area/maxArea);

    is expecting that the expression’s property is scale. If you comment that line out you’ll see it comes up with 6600 for area. Not sure where you want to go with it from there.

  • Dan Ebberts

    February 14, 2022 at 8:37 pm in reply to: finding layers in another comp and extracting values…

    Should be do-able. It might look something like this:

    c = comp("CompAreas");

    maxArea = 99999; // whatever the area is for the largest country

    str = "";

    for (i = 1; i <= c.numLayers; i++){

    if (! (c.layer(i).name.indexOf(name) == 0)) continue;

    str = c.layer(i).name;

    break;

    }

    if (str != ""){

    area = parseInt(str.split(",")[1],10);

    value*(area/maxArea);

    }else

    value

    You’d probably want to add more error checking if other people will be using it (like making sure the layer name in CompAreas actually has a comma in it instead of just assuming it does).

Page 97 of 1081

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