Random letter particle generator

Scripting for After Effects

Random letter particle generator

Postby JonL on 08/8/2008, 1:07 pm

I'm trying to get Trapcode particular to shoot out the 26 letters of alphabet randomly as particles, but the only way that I can think of doing this is to have 26 separate custom particles for each letter. Is there a way which I can get the letters to shoot out of just one emitter? ( maybe there's a way to do this by just using coding). :?
JonL
 
Posts: 17
Joined: 08/2/2008, 1:03 pm

Re: Random letter particle generator

Postby wtf.cakes on 08/8/2008, 1:24 pm

You could probably write an expression to randomize a letter within a comp and then use that comp as a custom particle.
wtf.cakes
 
Posts: 101
Joined: 08/1/2008, 8:18 pm
Location: Montreal

Re: Random letter particle generator

Postby Jayblo on 08/8/2008, 2:24 pm

JonL wrote:I'm trying to get Trapcode particular to shoot out the 26 letters of alphabet randomly as particles, but the only way that I can think of doing this is to have 26 separate custom particles for each letter. Is there a way which I can get the letters to shoot out of just one emitter? ( maybe there's a way to do this by just using coding). :?

Hi Jonl
Check this
- creat a small comp 100*100
- put a text layer(layer>text)
- put this code in the text source

Code: Select all
alphabet="abcdefghijklmnopqrstuvwxyz0123456789";
alphabet[Math.floor(random(alphabet.length))];


- Then nest your text layer in a normal comp( I mean your final output size)
- hide it
- creat a new layer add particular to it
- then assign you text layer a particle
- do ramp preview
that all
Thanks goes to NABscripts

Best
Jayblo
Jayblo
 
Posts: 167
Joined: 08/3/2008, 4:39 am
Location: Africa

Re: Random letter particle generator

Postby oranges on 08/8/2008, 8:20 pm

Jayblo wrote:
JonL wrote:I'm trying to get Trapcode particular to shoot out the 26 letters of alphabet randomly as particles, but the only way that I can think of doing this is to have 26 separate custom particles for each letter. Is there a way which I can get the letters to shoot out of just one emitter? ( maybe there's a way to do this by just using coding). :?

Hi Jonl
Check this
- creat a small comp 100*100
- put a text layer(layer>text)
- put this code in the text source

Code: Select all
alphabet="abcdefghijklmnopqrstuvwxyz0123456789";
alphabet[Math.floor(random(alphabet.length))];


- Then nest your text layer in a normal comp( I mean your final output size)
- hide it
- creat a new layer add particular to it
- then assign you text layer a particle
- do ramp preview
that all
Thanks goes to NABscripts

Best
Jayblo
If you follow this, you'll probably want to select a different Time Sampling mode for your custom particle other than "Current Time", from what I understand of the effect you're going for. I suggest "Random - Still Frame".
oranges
 
Posts: 10
Joined: 08/1/2008, 8:12 pm

Re: Random letter particle generator

Postby Jayblo on 08/9/2008, 5:58 am

oranges wrote:If you follow this, you'll probably want to select a different Time Sampling mode for your custom particle other than "Current Time", from what I understand of the effect you're going for. I suggest "Random - Still Frame".


You are right :D
Jayblo
 
Posts: 167
Joined: 08/3/2008, 4:39 am
Location: Africa

Re: Random letter particle generator

Postby oranges on 08/9/2008, 9:06 am

Just another thing, you could also generate random words by using an array instead of a single string, if... if you wanted to, for any reason. :geek:
Code: Select all
words = ["apple","banana","pear"];
words[Math.round(random(words.length-1))];
oranges
 
Posts: 10
Joined: 08/1/2008, 8:12 pm

Re: Random letter particle generator

Postby tequilaman2006 on 08/9/2008, 2:23 pm

what oranges said above suggests something that Jayblo missed. here is the code you'll want to use:
Code: Select all
    alphabet="abcdefghijklmnopqrstuvwxyz0123456789&";
    alphabet[Math.floor(random(alphabet.length-1))];


it is important to remember that AE index's arrays starting at the value zero, not one. (remember how the value of the x-axis parameters is always [0] ?)

so if you do not add the -1 at the end, you will never get a value of zero, which means the letter "a" will never show up... because of this, i would throw an extra piece at the end of the code like the & sign. this value will never be selected, because it is at the end and 1 is always subtracted...

hopefully i didnt completely screw up somewhere, feel free to correct me. :P
"Is it the right of the postal service to search every package to see if I'm sending you a photocopied novel? if its not right in the analog world, it isn't right in the digital world either."

--a very smart person.
tequilaman2006
 
Posts: 163
Joined: 08/2/2008, 11:54 pm
Location: the mindless downloads of america

Re: Random letter particle generator

Postby JonL on 08/9/2008, 7:23 pm

Thanks guys, mission accomplished :P
JonL
 
Posts: 17
Joined: 08/2/2008, 1:03 pm

Re: Random letter particle generator

Postby tequilaman2006 on 08/9/2008, 7:41 pm

ok, i know the OP already got his expression, but i wanted to say sorry for messing up above (as i noted i might have.)

the random expression is generating a # between 0 and the length, so you do NOT need to subtract 1 from the value.

at least i caught myself before anyone else did. lol...
"Is it the right of the postal service to search every package to see if I'm sending you a photocopied novel? if its not right in the analog world, it isn't right in the digital world either."

--a very smart person.
tequilaman2006
 
Posts: 163
Joined: 08/2/2008, 11:54 pm
Location: the mindless downloads of america

Re: Random letter particle generator

Postby pinoyword7up on 08/15/2008, 8:11 pm

this random is going too fast. How do I slow it down?
pinoyword7up
 
Posts: 17
Joined: 08/2/2008, 10:42 am

Re: Random letter particle generator

Postby Jayblo on 08/18/2008, 1:41 pm

pinoyword7up wrote:this random is going too fast. How do I slow it down?


I think here is the way to go

oranges wrote:If you follow this, you'll probably want to select a different Time Sampling mode for your custom particle other than "Current Time", from what I understand of the effect you're going for. I suggest "Random - Still Frame
Jayblo
 
Posts: 167
Joined: 08/3/2008, 4:39 am
Location: Africa

Re: Random letter particle generator

Postby Doogle on 08/21/2008, 8:24 am

I wanted this kind of effect only using asteroid images instead of text for an asteroid belt.
I ended up using a comp with each asteroid image in a sequence ie |-image1-|-image2-|-image3-| etc and then set particular to use the sequence with the split clip and then set the number of clips to the number of images (in your case, 26)

The downside was that it would spit out a long line of the same image over time :(
Doogle
 
Posts: 23
Joined: 08/15/2008, 6:59 am
Location: Sherwood Forest

Re: Random letter particle generator

Postby Dirtstyle on 09/14/2008, 3:45 am

Hi everybody,

I'd like to know if there was a way to randomize the fonts as well,
so that the expression creates a random letter with a random font.

Thanks in advance.
Dirtstyle
 
Posts: 1
Joined: 09/14/2008, 3:36 am

Re: Random letter particle generator

Postby multiabhay on 09/20/2008, 11:33 am

you better use the Ae inbuild particle generator
Particles playground
for changing particles in characters
steps:
-create a solid
-apply particles playground effect
-go to options
-click edit cannon text
-write the whole aphabets or numbers
-hit ok .
there you go!

and for randomaly changing characters you could use a layer map
steps:
-create a solid
-apply fractal noise
-animate evolution property
-precompose it . rename it whatever " map" be sure to "Move attr to new comp" checked on
-go to particles playground choose emphemeral property mappers.
-choose Layer map as - choose the map you created
- In affects use map red or blue or green anyone to character.
- play with min max value you could start with min -0 , max = 300; or so.
enjoy
multiabhay
 
Posts: 80
Joined: 08/2/2008, 8:59 am
Location: Mumbai, India
System Specs: Processor : i5 6500, Motherboard : MSI B150M, Ram : Kingston Hyperx 16GB,
SSD : Kingston 240GB, Gfx : Geforce 1060.
OS : Linux (KDE NEON)

Re: Random letter particle generator

Postby BHarrison on 09/26/2008, 5:31 pm

Quick question.

Is it possible to make the random expression change the letter every few frames instead of every frame?

Changing it say every third frame, and leaving the particle generator on the normal setting would give it a neat scrolling look on each particle.
BHarrison
 
Posts: 17
Joined: 09/14/2008, 9:38 am

Re: Random letter particle generator

Postby bryan_ on 10/6/2008, 7:41 pm

words = ["apple","banana","pear"];
words[Math.round(random(words.length-1))];


the first line is basically defining a variable. right?
what about the second line? can anyone explain what's going on there?
bryan_
 
Posts: 10
Joined: 09/20/2008, 12:47 pm

Re: Random letter particle generator

Postby tequilaman2006 on 10/7/2008, 7:46 pm

you are correct. sort of.

it isnt so much as a "variable". instead, it is a "vector".

this basically means that you are storing multiple values in one "variable", which can be called upon separately. to do this, you define the parts to the vector called "words". the parts were: apple, banana, and pear.

just like position[0] calls upon the X-coordinate (or the first number of the position vector), words[0] calls upon the first value (or text, in this case) defined earlier. words[0]=apple, words[1]=banana, and so on.

now to line 2. first, you have: "words[" which tells you you will be requesting a value from the words vector. next, instead of a 0 or 1, you have a mathematical/Java expression to come up with a random value, which will, in turn, return a word from the Words vector.

words.length returns how many words you stored in the vector (currently, 3). you subtract 1 because AE starts counting at zero, so if the random generator comes up with 2, that corresponds to the second vector value: words[1] (or, words[2-1]). the round part just insures that you get an integer in place of a decimal or something like that.

hope it all makes sense.... :P
"Is it the right of the postal service to search every package to see if I'm sending you a photocopied novel? if its not right in the analog world, it isn't right in the digital world either."

--a very smart person.
tequilaman2006
 
Posts: 163
Joined: 08/2/2008, 11:54 pm
Location: the mindless downloads of america

Re: Random letter particle generator

Postby bryan_ on 10/10/2008, 9:42 am

thnx for the explanation.
i pulled the following info off cgsutra.com -i think it's somewhat relevant to expressions, however, this regards to MEL (maya embedded language) and not AE expressions. there seems to be similarities though.
-------------------
Variable name always start with a $ sign. Variable names are case sensitive. MEL considers $name, $Name and $NAME to be different variables.

$age
$newEmail
$name01
$new_email
$_city

TYPES OF MEL VARIABLES
int - An integer number—used to represent a whole number, such as 98 or –6.
float - A decimal number—used to represent a real number, such as –6.98 or 223.76.
string - A set of characters surrounded by quotes—used to store text, such as “hi there”.
vector - Three float numbers separated by commas, surrounded by angled brackets, such as <<01, 45, 20 >>.
array - A list of numbers—used to store lists of integers, floats, strings, or vectors. such as $color [3].
matrix - A two-dimensional array of floats or an array of float arrays.
bryan_
 
Posts: 10
Joined: 09/20/2008, 12:47 pm

Re: Random letter particle generator

Postby jackincognito on 10/22/2008, 8:39 pm

JonL, You might be able to utilize a '3D Text Creator' script from http://www.aescripts.com
It generates all the layers and distributes them in a user determined 3D space (within the actual script) . It also gives you control over individual characters, color, and opacity.
I take it since it's an asteroid belt it wont be constantly emitting, so you just have to define the space you want the characters generated in, precomp them, then add to your animation.

Hope this helps.
jackincognito
 
Posts: 51
Joined: 08/3/2008, 7:26 pm
Location: Southern California

Re: Random letter particle generator

Postby graymachine on 10/23/2008, 5:34 am

"vector" ? Do you mean "array"?

Vector is typically something that expresses both length and direction. Maybe I am missing something.
Harry Frank
Motion design tutorials, elements and more.
http://www.graymachine.com
graymachine
VC Moderator
VC Moderator
 
Posts: 981
Joined: 08/4/2008, 6:38 pm
Twitter: graymachine

Re: Random letter particle generator

Postby jackincognito on 10/23/2008, 11:21 am

How could the same effect be created with images?
jackincognito
 
Posts: 51
Joined: 08/3/2008, 7:26 pm
Location: Southern California

Re: Random letter particle generator

Postby VFX-Anomaly on 10/23/2008, 12:00 pm

graymachine wrote:"vector" ? Do you mean "array"?

Vector is typically something that expresses both length and direction. Maybe I am missing something.


He is speaking about MEL in Maya (Maya Embedded Language), Vector as in coordinates.
http://www.fundza.com/mel/axis_to_vecto ... ector.html
http://en.wikipedia.org/wiki/Coordinate_vector
VFX-Anomaly
 
Posts: 1048
Joined: 08/1/2008, 6:32 pm
Location: Southern California

Re: Random letter particle generator

Postby jackincognito on 10/23/2008, 10:34 pm

Nevermind, figured it out. No expression necessary. :)
jackincognito
 
Posts: 51
Joined: 08/3/2008, 7:26 pm
Location: Southern California

Re: Random letter particle generator

Postby john dangerous on 03/14/2009, 11:35 am

So can the font be changed?
john dangerous
 
Posts: 27
Joined: 12/30/2008, 3:05 pm

Re: Random letter particle generator

Postby Mylenium on 03/14/2009, 1:57 pm

No, not at all.

Mylenium
[Pour Mylène, ange sur terre]
----------------------------------------
www.myleniumblog.com
Mylenium
 
Posts: 3263
Joined: 02/1/2009, 11:45 am
Location: Germany
System Specs: Have, I do!

Next

Return to After Effects Expressions

cron