Forum Replies Created

  • Moniek Van adrichem

    November 16, 2015 at 8:08 pm in reply to: Random change to specific color

    Woohoo! I figured it out, the problem was that you get a string from the Source Text, so you first need to convert that to an Array. Also I had to make a workaround on the fact that the square brackets in the middle get removed. I guess there’s a more elegant solution, but this works 😀

    ctrl = thisComp.layer("colours");

    colorstring=ctrl.text.sourceText;
    colors=colorstring.split(",");
    minDur = ctrl.effect("minDuration")("Slider")
    maxDur = ctrl.effect("maxDuration")("Slider");
    seedRandom(index,true)
    segDur = random(minDur,maxDur);
    easeTime = ctrl.effect("easeDuration")("Slider");

    curSeg = Math.floor(time/segDur);
    t = time%segDur;
    seedRandom(curSeg,true);
    idx1 = (Math.floor((random(colors.length))/4))*4;
    seedRandom(curSeg-1,true);
    idx0 = (Math.floor((random(colors.length))/4))*4;
    color0 = colors.slice(idx0,(idx0+4));
    color1 = colors.slice(idx1,(idx1+4));
    ease(t,0,easeTime,color0,color1)

  • Moniek Van adrichem

    November 16, 2015 at 7:29 pm in reply to: Random change to specific color

    When evaluating the expression in another Source Text I found that somehow the square brackets which define the color-arrays are removed when using

    ctrl = thisComp.layer(“colours”);
    colors=ctrl.text.sourceText.value;

    So that might be the problem

  • Moniek Van adrichem

    November 16, 2015 at 6:54 pm in reply to: Random change to specific color

    That’s what I thought as well, but somehow that gives this error (which refers to the line of idx1=Math.floor(random(colors.length))):

    property or method named “length” in Class “Number” is missing or does not exist. It may have been renamed, moved, deleted, or the name may have been mistyped.

    The weird thing is that I don’t get this error when putting the numbers directly in the expression.

    ctrl = thisComp.layer("colours");

    colors=eval(ctrl.text.sourceText.value);
    minDur = ctrl.effect("minDuration")("Slider")
    maxDur = ctrl.effect("maxDuration")("Slider");
    seedRandom(index,true)
    segDur = random(minDur,maxDur);
    easeTime = ctrl.effect("easeDuration")("Slider");

    curSeg = Math.floor(time/segDur);
    t = time%segDur;
    seedRandom(curSeg,true);
    idx1 = Math.floor(random(colors.length));
    seedRandom(curSeg-1,true);
    idx0 = Math.floor(random(colors.length));
    ease(t,0,easeTime,colors[idx0],colors[idx1])

  • Moniek Van adrichem

    November 16, 2015 at 7:24 am in reply to: Random change to specific color

    I thought the most convenient way would be to use an array of arrays like this:

    [[141,203,235,255]/255,
    [164,213,239,255]/255,
    [205,219,143,255]/255]

    But if its easier to use the 0-1 values that’s fine too 🙂

  • Moniek Van adrichem

    November 15, 2015 at 10:57 pm in reply to: Random change to specific color

    Thanks so much, that works! So now I wanted to put the color values in the source text of a textlayer, so I could later decide to add or delete a color. Problem is that I cannot get my head around how to do this…


    http://www.megamoniek.nl

  • Moniek Van adrichem

    November 12, 2015 at 10:39 pm in reply to: Random change to specific color

    Hi Dan,

    I was wondering if it would be possible to make it so that the squares all randomly get a color and duration assigned (which is different for each square). But that you can set the colors and range for the duration in a Control null, so that you can easily adjust that.

    Thanks a lot!

    Moniek


    http://www.megamoniek.nl

  • Moniek Van adrichem

    May 30, 2014 at 9:26 pm in reply to: animate layer position with angle control

    That’s exactly what I was looking for, thanks so much!

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