Page 1 of 2

Random letter particle generator

PostPosted: 08/8/2008, 1:07 pm
by JonL
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). :?

Re: Random letter particle generator

PostPosted: 08/8/2008, 1:24 pm
by wtf.cakes
You could probably write an expression to randomize a letter within a comp and then use that comp as a custom particle.

Re: Random letter particle generator

PostPosted: 08/8/2008, 2:24 pm
by Jayblo
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

Re: Random letter particle generator

PostPosted: 08/8/2008, 8:20 pm
by oranges
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".

Re: Random letter particle generator

PostPosted: 08/9/2008, 5:58 am
by Jayblo
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

Re: Random letter particle generator

PostPosted: 08/9/2008, 9:06 am
by oranges
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))];

Re: Random letter particle generator

PostPosted: 08/9/2008, 2:23 pm
by tequilaman2006
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

Re: Random letter particle generator

PostPosted: 08/9/2008, 7:23 pm
by JonL
Thanks guys, mission accomplished :P

Re: Random letter particle generator

PostPosted: 08/9/2008, 7:41 pm
by tequilaman2006
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...

Re: Random letter particle generator

PostPosted: 08/15/2008, 8:11 pm
by pinoyword7up
this random is going too fast. How do I slow it down?

Re: Random letter particle generator

PostPosted: 08/18/2008, 1:41 pm
by Jayblo
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

Re: Random letter particle generator

PostPosted: 08/21/2008, 8:24 am
by Doogle
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 :(

Re: Random letter particle generator

PostPosted: 09/14/2008, 3:45 am
by Dirtstyle
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.

Re: Random letter particle generator

PostPosted: 09/20/2008, 11:33 am
by multiabhay
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

Re: Random letter particle generator

PostPosted: 09/26/2008, 5:31 pm
by BHarrison
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.

Re: Random letter particle generator

PostPosted: 10/6/2008, 7:41 pm
by bryan_
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?

Re: Random letter particle generator

PostPosted: 10/7/2008, 7:46 pm
by tequilaman2006
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

Re: Random letter particle generator

PostPosted: 10/10/2008, 9:42 am
by bryan_
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.

Re: Random letter particle generator

PostPosted: 10/22/2008, 8:39 pm
by jackincognito
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.

Re: Random letter particle generator

PostPosted: 10/23/2008, 5:34 am
by graymachine
"vector" ? Do you mean "array"?

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

Re: Random letter particle generator

PostPosted: 10/23/2008, 11:21 am
by jackincognito
How could the same effect be created with images?

Re: Random letter particle generator

PostPosted: 10/23/2008, 12:00 pm
by VFX-Anomaly
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

Re: Random letter particle generator

PostPosted: 10/23/2008, 10:34 pm
by jackincognito
Nevermind, figured it out. No expression necessary. :)

Re: Random letter particle generator

PostPosted: 03/14/2009, 11:35 am
by john dangerous
So can the font be changed?

Re: Random letter particle generator

PostPosted: 03/14/2009, 1:57 pm
by Mylenium
No, not at all.

Mylenium