Forum Replies Created

Page 7 of 24
  • Scott Mcgee

    March 11, 2019 at 2:11 pm in reply to: Opacity control from data in .json

    Try below if the input is working. Looks like you’re missing an =. should be ==

    input = footage(“datafile.json”).sourceData[46].NAMES;

    if (input == thisLayer.name){value = 100}
    else {0};

  • Scott Mcgee

    March 11, 2019 at 2:09 pm in reply to: Toggle Hold value between keyframes?

    Hi,

    Your expression tells it to animate between 1 and 2 between those values. So that’s the reason for that.

    If you want it to snap. You need to look at nearestKey expression.

    Quickly pinched this from Dan, if no one else responded. This is kind of what you are after but will need to play with it a little.

    This essentially snaps to the value you the nearest keyframe

    p = transform.opacity;
    n = 0;
    if (p.numKeys > 0){
    n = p.nearestKey(time).index;
    if (p.key(n).time > time) n–;
    }
    if (n> 0)
    p.valueAtTime(p.key(n).time)
    else
    value

  • Scott Mcgee

    February 27, 2019 at 8:41 am in reply to: Timecode Expression

    Cheers Alex,

    I would never have thought of doing that.

    I did get an error back because the timecode wasn’t in “”, but then it worked perfectly

    t = “00:00:02:00”;

    var f = 0;
    for(i=0; i<4; i++){
    d = t.split(“:”)[i];
    try{d = d.split(“:”)[0]}catch(e){};
    f += parseInt(d);
    if(i<2) f*=60;
    if(i==2)f*=(1/thisComp.frameDuration);
    }

    if(time < framesToTime(f)){
    100
    }else{
    0
    };

  • No problem,

    Just because I’ve had a chance to test them. The ease expression didn’t work how I thought it would. So as an alternative. I’m recorrecting the method just incase anyone tries it and fails.

    txt = footage(“Test.json”).sourceData;

    a = txt.One;
    b = txt.Two;
    c = txt.Three;
    d = txt.Four;

    if (time < 1){
    linear(time,inPoint,inPoint+1,a,b)
    }else if (time < 2){
    linear(time,inPoint+1,inPoint+2,b,c)
    }else linear(time,inPoint+2,inPoint+3,c,d);

    Looking at the expression you’ve posted, it just makes it tidier to for loop through. So you don’t have to keep writing else if, for when you have 20 linear(time,t1,t2,v1,v2) expressions. Glad you found that I was struggling to find a for loop which will come in handy myself. 🙂

  • So there’s 2 ways you could do this. (Haven’t tested these. So you may have to tweak if they don’t work)

    If your Json was to look like this.

    “One” : 0,
    “Two” : 50,
    “Three” : 100,
    “Four” : 10

    First way allows to change timings based on keyframes. So set up your keyframes and add the below expression to the element you wish to animate.

    txt = footage(“Country.json”).sourceData;

    Key(1).value = txt.One;
    Key(2).value = txt.Two;
    Key(3).value = txt.Three;
    Key(4).value = txt.Four;

    Alternatively you can (found this on rocketstock. Again not tested)

    a = txt.One;
    b = txt.Two;
    c = txt.Three;
    d = txt.Four;

    ease(time,inPoint,inPoint+1,[a],[b]) + ease(time,inPoint+1,inPoint+2,[b],[c]) + ease(time,inPoint+2,inPoint+3,[c],[d]);

    Hopefully one of those does the trick for you.

  • Scott Mcgee

    February 14, 2019 at 9:41 am in reply to: Animation Menu

    Simple answer is yes.

    I can think of a few ways you can accomplish this, but I left this up to my assistant to do as she was better than me with animation cycles.

    So you can build a plugin script that you can use to trigger your cycles using time remap. If your characters are all the same like a job I worked on. You could build a script that will create those cycles, I have built a few scripts that build templates, but it’s the same thing. This might save more time in rendering, but based on what my assistant used to do. Time Remapping and having the script trigger A,B or C that changed the expression to loop sections worked just as good.

    Sorry I can’t give much info, but the idea is essentially

    buttonOne = myPanel.add (“button”,undefined,”Default”);

    buttonOne.onClick = function(){
    var myComp = app.project.activeItem;
    myComp.layer(“Vendor”).property(“ADBE Text Properties”).property(“ADBE Text Document”).setValue(“Default”);
    };

    Obviously the last line myComp.layer….needs to be replaced with what you want to do, but that is it really in simple terms.

  • Scott Mcgee

    February 8, 2019 at 2:15 pm in reply to: Right aligned text – sourceRectAtTime

    Hey Lucy,

    Try this

    content(“Rectangle 1”).content(“Rectangle Path 1”).size/1

    I’d normally set my anchor point to achieve this rather than put it in the position of the shaper layer contents.

    so my anchor point would use this to do the exact same thing. Spent a few minutes looking at yours and daft as it sounds. Soon as you put /1 it works.

    r = sourceRectAtTime();
    [r.left + r.width, r.top]

    Hope that helps

  • Scott Mcgee

    January 3, 2019 at 8:50 am in reply to: scripting: fill color same as layer label color?

    Ah Gotch ya,

    well I did find this (below), which doesn’t look promising. It states that there is no way to set them programmatically, which means that if someone has changed the colours themselves that would prove a problem with what you want to do. You can certainly get it to mimic with what I read, but I’d look at what I sent previous and create your own palette. That way you can guarantee the colour. I could be wrong as I’m not hugely confident in this area, as I’m always finding hacks when I want to.

    MarkerValue.label

    app.project.item(index).layer(index).property(“Marker”).keyValue(index).label

    Description

    The label color for a composition or layer marker. Colors are represented by their number (0 for None, or 1 to 16 for one of the preset colors in the Labels preferences). Custom label colors cannot be set programmatically.

    Available in After Effects 16.0 or later.

    Type

    Integer (0 to 16); read/write.

  • Scott Mcgee

    January 2, 2019 at 9:05 am in reply to: scripting: fill color same as layer label color?

    I can guarantee that it work though. As I use it with my plugin.

  • Scott Mcgee

    January 2, 2019 at 9:03 am in reply to: scripting: fill color same as layer label color?

    I think I’ve copied and pasted all that you need.

    Essentially, I create an array of colours I want, then create all my buttons using the fillBrush. Then use the array to array through my buttons to match the same colour of the array.

    Hopefully the below makes sense, because I still struggle to understand it with the Array bouncing out of other arrays, it took a few days of attempting this for me to get it to work.

    var pcolor = new Array([0/255,68/255,137/255,255/255],[255/255,255/255,255/255,255/255])

    var b = new Array();
    for(var i = 0; i <= 1 ; i++ ){
    b[i] = groupOne.add (‘iconbutton’, undefined, undefined, {name:’Blue’, style: ‘toolbutton’});
    b[i].size = [30,20];
    b[i].fillBrush = b[i].graphics.newBrush(b[i].graphics.BrushType.SOLID_COLOR,pcolor[i]);
    b[i].onDraw = customDraw;
    function customDraw()
    { with( this ) {
    graphics.drawOSControl();
    graphics.rectPath(0,0,size[0],size[1]);
    graphics.fillPath(fillBrush);
    if( text ) graphics.drawString(text,textPen,(size[0]-graphics.measureString (text,graphics.font,size[0])[0])/2,3,graphics.font);
    }}
    }

    for(var i = 0; i <= 1 ; i++ ){
    b[i].onClick =
    (function(i){
    return function() {
    app.beginUndoGroup(“AddEffect”);
    var curItem = app.project.activeItem;
    var selectedLayers = curItem.selectedLayers;

    for (var j = 0; j < selectedLayers.length; j++) {

    try {
    curRem = selectedLayers[j].effect.property(“Fill”).remove();
    curLayer = selectedLayers[j].Effects.addProperty(“ADBE Fill”)(“Color”).setValue(pcolor[i]);
    }
    catch (err) {
    curLayer = selectedLayers[j].Effects.addProperty(“ADBE Fill”)(“Color”).setValue(pcolor[i]);
    }
    }

    app.endUndoGroup();
    }
    })(i);
    }

Page 7 of 24

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