Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Character randomizer, but limited to certain letters

  • Character randomizer, but limited to certain letters

    Posted by James Wightman on July 4, 2023 at 2:32 am

    Hi all, I’ve been spending a few hours trying to figure this out via google and chatgpt to no avail.

    I’m trying to make a teaser video for a band called ‘TRAINDODGE’. I want 10 characters on a text layer to randomly cycle between only those letters, just never in the right order (so any frame you freeze you could unscramble it to read traindodge). I got an expression from chatgpt that successfully used only those letters but included duplicates, then I got one that used only the correct 10 values but the two D’s were always the first two characters. It then spit out an update, and whatever’s in that updated code freezes and crashes my AE every time I try to paste it in.

    Filip Vandueren replied 3 years, 2 months ago 3 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    July 4, 2023 at 3:13 am

    This is probably not exactly what you’re looking for, but it might be close:

    letters = ["T","R","A","I","N","D","O","D","G","E"];
    holdTime = 1; // hold for 1 second
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);
    for (i = 0; i < letters.length; i++){
    idx = Math.floor(random(letters.length));
    temp = letters[i];
    letters[i] = letters[idx];
    letters[idx] = temp;
    }
    s = "";
    for (i = 0; i < letters.length; i++) s += letters[i];
    s
  • Filip Vandueren

    July 4, 2023 at 11:25 am

    Just for fun, here it is as a one-liner in Javascript:

    "TRAINDODGE".split("").reduceRight( (output,val,ind,arr) => output+=arr.splice(random(arr.length),1) ,"");

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