Forum Replies Created

Page 14 of 24
  • Scott Mcgee

    April 5, 2018 at 7:54 am in reply to: control multiple positions with expression

    There is probably a better way of doing this, which if you check out Dan Ebberts…There will be a for loop expression for this.

    but something like this would work if you are just using the 6 keyframes like you have in your project.

    All you are doing is telling it if you are between certain key frames to do something. Obviously then link your sliders to the bits you need to change, but I’ve just whipped this up quickly.

    t1 = key(1).time;
    t2 = key(2).time;
    t3 = key(3).time;
    t4 = key(4).time;
    t5 = key(5).time;
    t6 = key(6).time;

    pos1 = [thisComp.width, thisComp.height/2];
    pos2 = [thisComp.width/2, thisComp.height/2];
    pos3=pos2;
    pos4 = [thisComp.width/3, thisComp.height/2];
    pos5 = pos4;
    pos6 = pos1;

    if(time <= t2){
    ease(time,t1,t2,pos1,pos2)
    } else if (time > t2 && time < t4){
    ease(time,t3,t4,pos3,pos4)
    } else {
    ease(time,t5,t6,pos5,pos6)
    }

  • I have this issue when writing eval functions in After Effects.

    wl = loc + city + “/weatherdata” + thisComp.layer(index+num).name.toLowerCase() +”.txt”;
    wl += “/”;
    $.evalFile(wl);

    This is how I use it in after effects. I don’t know if it’s the same in extendscript as I’ve never had the needed to try it.

  • Scott Mcgee

    March 28, 2018 at 7:49 am in reply to: acceleration expression

    I can’t take credit for this, but this works.

    I’ve not been successful in getting this to work with a position expression yet, but I’ve not tried hard enough.

    I usually do exponential scaling with a slider:

    add a expression slider-control to your layer and rename the slider to “Z”

    Give the layer’s scale this expression:

    exp = effect(“Z”)(“Slider”);
    Math.pow(1.01,exp) * value;

    Positive values for the slider => bigger, negative => smaller.
    The nice thing about this is that you can ease the keyframes on that slider. Or even add an expression to it etc. (I usually add a smooth).
    you can also still use the scale of the value if you need to flip or disproportiantely scale the layer because it get’s mulitplied in.

    If you want the 2D-position to also fake perspective (smaller= nearer to the vanishing point), add this expression to position:

    exp = effect(“Z”)(“Slider”);

    compCenter=[thisComp.width,thisComp.height]/2;

    compCenter + Math.pow(1.01,exp) * (value-compCenter);

    Note: if your layers are parented, stuff get’s more complicated, so this will probably not look okay then.

  • Scott Mcgee

    March 19, 2018 at 2:56 pm in reply to: for loop Array

    Not sure how I got this to work, but I’m taking it as a win.

    Anyone who might be struggling with this here’s how I got it to work.

    input = thisComp.name;

    var myArray = [“BL”, “CF”, “LS”];
    var myResult = [“Bristol”,”Cardiff”,”Leeds”]

    result = null;
    for (var i = 1; i <= myArray.length; i++){
    if (input.indexOf(myArray[i]) > -1){
    result = i;
    break;
    }
    }
    myResult[result]

  • Scott Mcgee

    March 7, 2018 at 9:59 am in reply to: for loop (opacity)

    For the fact I’m struggling my guessing game is getting better.

    val = null;
    for ( i = index+1; i <= thisComp.numLayers; i++){
    try{
    L = thisComp.layer(i)
    if(L.transform.opacity == 0) continue;
    if(L.transform.opacity == 100){
    val = L.transform.position[1] + 40;
    }
    if(L.transform.position[1] > 600){
    val = thisComp.layer(“She 10”).transform.position[1];
    }
    break;
    }catch(err){
    }
    }
    [value[0],val]

    If anyone can think of a tidier way, but at least it works now.

  • Scott Mcgee

    March 7, 2018 at 9:50 am in reply to: for loop (opacity)

    Well I got it working at least.

    val = null;
    for ( i = index+1; i <= thisComp.numLayers; i++){
    try{
    L = thisComp.layer(i)
    if(L.transform.opacity == 0) continue;
    if(L.transform.opacity == 100){
    val = L.transform.position[1] + 40;
    }
    break;
    }catch(err){
    }
    }
    [value[0],val]

    Now is there a way if you go over a certain amount of layers it’ll start from the beginning.

    Title Layer2
    Layer1 Layer3
    Layer2 Layer4
    Layer3
    Layer4 Title
    Layer1
    Title Layer2
    Layer1 Layer3

  • Scott Mcgee

    February 7, 2018 at 2:30 pm in reply to: Array value rather than content

    Cheers Dan that works brilliantly.

    I was trying to use it in conjunction with referencing my Json file…Someone from IT had pointed out that you can title your keys. So they don’t have to be [0] or [1], you can give them values.

    So this works better than what I wanted to use it for. I’ve just posted it up as I could not find anything mentioning about labelling Json’s like this. So I think it’s worth sharing.

    {
    “bristol”:{
    “city”:”BRISTOL”,
    “condition1″:”Partly Cloudy”,
    “condition2″:”Partly Cloudy”,
    “condition3″:”Partly Cloudy”,
    “condition4″:”Partly Cloudy”,
    “condition5″:”Partly Cloudy”,
    “condition6″:”Partly Cloudy”,
    “maxtemp1”:6,
    “maxtemp2”:8,
    “maxtemp3”:8,
    “maxtemp4”:8,
    “maxtemp5”:8,
    “maxtemp6”:8,
    “windspeed1”:20,
    “windspeed2”:20,
    “direction1”:131,
    “direction2”:131
    },
    “bath”:{
    “city”:”BATH”,
    “condition1″:”Heavy Rain”,
    “maxtemp1”:4,
    “maxtemp2”:8,
    “windspeed1”:20,
    “windspeed2”:20,
    “direction1”:131,
    “direction2”:131
    }
    }

  • I’d use something like this, if you are just pre embedding the colours. The below allows you to go based on Hex value, just make sure to add 0x at the fron of each one.

    I use something similar.

    if (slider == 6){
    a = 0x974040;
    }
    else if(slider == 7){
    a = 0x498ABB;
    }else{
    a = 0x8D8D8D;
    }

    txt = a;
    r = txt >> 16;
    g = (txt & 0x00ff00) >> 8;
    b = txt & 0xff;
    [r,g,b,255]/255

  • Scott Mcgee

    February 2, 2018 at 7:35 pm in reply to: Center anchorpoint, no matter the content of text field

    Sorry my fault, I put width again in the y part. This should work now.

    R = sourceRectAtTime();
    [R.left + R.width/2,R.top + R.height/2]

  • Scott Mcgee

    February 2, 2018 at 4:28 pm in reply to: Center anchorpoint, no matter the content of text field

    This should work

    R = sourceRectAtTime();
    [R.left + R.width/2,R.top + R.width/2]

Page 14 of 24

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