FORUMS: list search recent posts

Random Text Generator, in the style of an IP address

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeff Dickson
Random Text Generator, in the style of an IP address
on Feb 5, 2013 at 11:29:10 pm

I'm looking for a random text generator expression, and I want to put it in the format of how an IP address would look. Example: D8-3B-10-19-F7-DC

I need to display like that with the hyphens. Any help is appreciated.

Thanks.

Jeff Dickson


Return to posts index

Dan Ebberts
Re: Random Text Generator, in the style of an IP address
on Feb 6, 2013 at 12:30:15 am

Something like this maybe:


seedRandom(index,true);
s = "";
for (i = 0; i < 6; i++){
if (i > 0) s += "-";
str = Math.round(random(255)).toString(16).toUpperCase();
if (str.length < 2) str = "0"+str;
s += str;
}
s


Dan



Return to posts index

Jeff Dickson
Re: Random Text Generator, in the style of an IP address
on Feb 6, 2013 at 12:34:31 am

That works. You're the man Dan.

In addition, how do you make it animate so it toggles between random characters?


Return to posts index


Dan Ebberts
Re: Random Text Generator, in the style of an IP address
on Feb 6, 2013 at 1:16:02 am

If you wanted it to change 5 times per second, you could just change the first line, like this:


posterizeTime(5);
s = "";
for (i = 0; i < 6; i++){
if (i > 0) s += "-";
str = Math.round(random(255)).toString(16).toUpperCase();
if (str.length < 2) str = "0"+str;
s += str;
}
s



Dan



Return to posts index

Jeff Dickson
Re: Random Text Generator, in the style of an IP address
on Feb 6, 2013 at 4:39:10 pm

Awesome. That is perfect. Thank you Dan.


Return to posts index

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