Forum Replies Created

Page 18 of 24
  • Scott Mcgee

    September 18, 2017 at 7:50 pm in reply to: Numerical order

    I’m not great when it comes to Arrays, I’ve tried giving below a try, but it’s not working in the slightest for me.

    scores = [300,800,200,500,0,500];

    scoresIndices = new Array(scores.length);
    for (i = 0; i < scores.length; i++) scoresIndices[i] = [scores[i],i];

    scoresIndices.sort(function(a,b) {return b[0] – a[0]});

    scoresIndices[0][1]

    https://forums.creativecow.net/docs/forums/post.php?forumid=2&postid=1040199&univpostid=1040199&pview=t

  • Scott Mcgee

    September 18, 2017 at 11:38 am in reply to: Hex Code from text?

    Dan Ebberts posted this a while back for someone else

    hexColor = 0xfbd142;
    r = (hexColor >> 16)/255;
    g = ((hexColor & 0x00ff00) >> 8)/255;
    b = (hexColor & 0xff)/255;
    hsl = rgbToHsl([r,g,b,1]);

    You could set up your “Text” layer (source text) add this to the expression

    “0x” + text.sourceText;

    Then when you copy and paste the hex code it will automatically add the 0x at front.

    Then the above expression change to this.

    hexColor = thisComp.layer(“Text”).text.sourceText;
    r = (hexColor >> 16)/255;
    g = ((hexColor & 0x00ff00) >> 8)/255;
    b = (hexColor & 0xff)/255;
    hsl = rgbToHsl([r,g,b,1]);

    That should work for you.

  • Scott Mcgee

    September 12, 2017 at 7:30 am in reply to: Showing variable text source in different comps

    Apologies…

    This is what you want

    Curr = *Pick whipped Currency Layer that you can change*;
    text.sourceText.replace(“Curr”,Curr);

    Put that in source text

    This then allows you to put the Currency where you want it to go in the sentence.

    Hope that’s better.

  • Scott Mcgee

    September 11, 2017 at 12:19 pm in reply to: Showing variable text source in different comps

    Just pickwhip the sourceText to the one you will change…once they are all linked when you change it in that one…It will change it for all.

  • Scott Mcgee

    August 29, 2017 at 2:05 pm in reply to: Random Number

    That actually works quite nicely. Below is a few alterations, but if you know of a way so it doesn’t repeat the same number twice. I’ve tried a few things, but I’ve just resorted to what I’ve done below…Although I’d like to incorporate getMonth, so I can create a A*B or A+B so it’ll be different every day without repeating the same pattern each month…But unfortunately it fired back a lot of repeats and I can’t change all of them. So if there is a way to change a repeated number that would be cool…Otherwise I am very happy with this.

    Just because I want numbers 1-6, for some unknown reason it didn’t select 1 often and never selected 6. So i’ve changed it to

    D = Math.round(random(0,7));

    if(D == 0) 1
    else if (D == 7) 6
    else
    D;

    Just to be sure…I went through the course of 1-31 using a slider, it picked the same number in a row twice, so I’ve include that if the

    seedRandom(Date(0).split(” “)[2]) equals those two day, it just picks another number….

    A = Date(0).split(” “)[2];

    if (A == 5) A = 33
    else if (A ==26) A = 34
    else
    A;

    seedRandom(A,true);

    D = Math.round(random(0,7));

    if(D == 0) 1
    else if (D == 7) 6
    else
    D;

    So thank you.

  • Won’t lie, haven’t a foggiest. Tried a few things out. As it references the anchorPoint of the Master Comp, it’s just the illusion that if it hovers over it works. It doesn’t it’s basing it off the anchor point of the Null and as long as your precomp compares to the null’s anchor point it works.

    I tried getting the precomped items to reference the null object and rework out the difference, but I think the toWorld is setting it in stone…(I won’t lie don’t know much about toWorld and toComp.) with no success.

    best I can offer, as I hope Dan might look at this and go here’s an answer, but if not try these

    https://motionscript.com/design-guide/proximity.html
    https://motionscript.com/design-guide/collision.html

    The expressions for these are similar in a way the top one uses position over AnchorPoint, which I think might be more down the route you’ll want. The one below is a little more complex, but again it has the similar idea of if something crosses paths it reacts.

    This way might be a better solution, which you can precomp and get it to reference the cursor to the position, so when you move the position of the precomp, it should be able to rework itself out.

    Apologies if the above waffle makes no sense, but in my head I think thats your best option.

  • C = comp(“Kursdel-intro”).layer(“cursor”);
    and
    d = length(comp(“Kursdel-intro”).layer(“cursor”).position,position);

    This just needs to be relabelled to the name of the Precomp.

    So change this “comp(“Kursdel-intro”).layer(“cursor”)” to “comp(“Kursdel-intro”).layer(“NAME OF PRECOMP“)”

    I’ve just tested it on my machine, so as long as that’s what you want to do. That should connect it to the precomp instead of the NULL Object.

  • Scott Mcgee

    August 18, 2017 at 5:48 pm in reply to: IF / ELSE scale expression

    If you want it to just appear when it goes above 10, your expression was fine. You just need to apply it to shape10 opacity.

    if(thisComp.layer(“BARGRAPH”).transform.scale[1]>10) 100 else 0;

    Otherwise I’m confused on what you are trying to do.

    “I only need the SHAPE10 layer to appear on the screen when the BARGRAPH yscale reaches >10%.”

  • Scott Mcgee

    August 16, 2017 at 8:01 am in reply to: whats the best way to learn how to use expressions?

    I’ve learnt everything I know from a few individuals on here and youtube.

    Main one is Dan, who’s website is here.

    https://www.motionscript.com/index.html

    Dan has here and the adobe forum linked on his website as places of interest and a few other locations to gain and learn expressions and scripts.

    To learn the basics, I started with Video Tutorials on youtube. Started with basic expressions like wiggle and time, but my job requires me to use expression everyday, so I get a lot of practice in to develop my own way of writing expressions, but if I struggle. I’ll post up what I’m trying to do, followed by the expression I want to use or struggling to use. Then usually within 24 hours someone has replied.

    If you don’t understand an expression that someone replies…Ask “What does it mean”, most of us will explain how it works. Dan’s Website is brilliant for breaking down how the expressions work.

    So as for starting, video tutorials and practice. Then start looking at Dan’s site and these forums and get writing. I know Dan and a few others are far superior at this, and may advise differently, but that’s where I started 2 years ago.

  • Scott Mcgee

    August 9, 2017 at 12:34 pm in reply to: Date given + 7 or something else

    Apologies Dan, I’ve just made a mountain out of a mole hill and lightbulb has finally turned on…I didn’t realise what you had given was a simple as it was. I thought I was going to have to do more with it.

    var D = new Date(“31 September 2017”);
    var ms = D.getTime() + 7*24*3600*1000;
    var D2 = new Date(ms);

    var curDate = new Date(Date(0));

    if(curDate < D2) “Correct” else “Wrong”

Page 18 of 24

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