ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Building a scrabble expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Gerben Greuliker
Building a scrabble expression
on Jun 16, 2020 at 10:11:32 am
Last Edited By Gerben Greuliker on Jun 16, 2020 at 11:01:03 am

I'm trying to wrap my head around the following problem but haven't the faintest idea how to tackle this;
I need to build an adjustable scrabble expression with character weight (i.e. A=1, G=2, Q=...).

The idea is that my client can type a single character in an Action Essential textfield and the character will be accompanied with its corresponding number.
I can write simple expressions but this needs the skills of a veteran, anyone any ideas?
I will be eternally grateful ☺

Gr Gerben


Return to posts index

Dan Ebberts
Re: Building a scrabble expression
on Jun 16, 2020 at 6:35:17 pm

No idea really, but possibly something like this:

vals = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,3,4,4,8,4,10];
idx = value[0].toUpperCase().charCodeAt(0) - 65;
value[0] + vals[idx]


Dan



Return to posts index

Gerben Greuliker
Re: Building a scrabble expression
on Jun 17, 2020 at 9:14:33 am

Thanks Dan!

Works like a charm!
You use the UTF16 code as a base, I would never have thought of that ☺
The only 'tweak' that the code needs is that the numbers need a baseline shift and a smaller font size.
But I know that you cannot adres font size with an expression.

Is the solution to output the numeral on a different text layer?
Then you can control the all the characters properties independently.


Return to posts index


Gerben Greuliker
Re: Building a scrabble expression
on Jun 17, 2020 at 10:56:39 am

Found a sollution!
I've made two new text layers, pickwhipped the Source Text of the input layer and use Slice to trim of the unwanted character.
Probably not the cleanest method but it works!

For the character: thisComp.layer("SCRABBLE VARIABLE").text.sourceText.slice(0,1)
For the number: thisComp.layer("SCRABBLE VARIABLE").text.sourceText.slice(1)


Return to posts index

Gerben Greuliker
Re: Building a scrabble expression
on Jun 24, 2020 at 12:48:08 pm

Just hit a bump in the road...
I need to read the value/character from another layers source text and then apply the expression to it.
A simple thisComp.layer("character").text.sourceText doesn't do the trick.

What am I doing wrong?


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]