Forum Replies Created

  • Nikki Van onna

    March 25, 2016 at 12:28 pm in reply to: How to randomly change color of characters

    Hello Dan and Daniel,

    I’m trying to get this working too, only I think I’m missing something, cause it’s not really working.
    So far I set everything up the way it’s described earlier in this post:

    dur = 1; // length of time to hold each color
    seedRandom(textIndex,true);
    seg = Math.floor((time+random(999))/dur);
    seedRandom(seg,true);
    palette = [[0,33,65],[93,11,14],[100,83,0]];
    idx = Math.floor(random(palette.length));
    palette[idx]

    Now I also want to have a version where you never have the same color in a character next to each other.

    When I change the palette like Dan suggested:

    palette = [[0,33,65],[93,11,14],[100,83,0],[0,33,65],[93,11,14],[100,83,0]];
    idx = (textIndex-1)%palette.length;
    palette[idx]

    It’s not animating anymore, not jumping to other colors over time.

    Do you maybe know a solution? That would be great.

    In short:
    I want letters to jump from one color to another, in a range of 3 colors over time.
    But I never want the same color in characters that are next to each other.

    Would be great if you could help me out.

    Thanks in advance!

    Nikki

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