Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
Nathan S
Topic Author
Posts: 1
Joined: Fri Aug 27, 2004 7:38 am
Location: Indianapolis, IN

Create a flickering neon light effect.

Fri Aug 27, 2004 8:47 am

This expression creates a flickering effect on a layer - similar to a flickering neon light.

It is applied to the OPACITY of the layer. It picks a random number for the opacity value the layer only some of the time, based on whether another random number ("probability") is less than or equal to 1. You can change the likelyhood of a random opacity being selected by changing the value of "probability."

The rest of the time the opacity is set to the value of "opacity_normal" which is set to 100 by default.

This concept be easily adaptable to other times when you only want something to happen some of the time by using the if...else operators. For example - you could apply something similar to the position or rotation of a layer and it would hop around some of the time.

Nathan Shipley
Animator, IMS Productions


// HIGHER values for probability make a random opacity LESS likely.
// A value of 1 will always create a random opacity, a value of 2 will
// create a random opacity 50% of the time, value of 4 will be 25%, etc.

probability = 6;

// "opacity_normal" is the value set for opacity when the a random
// opacity is NOT chosen.

opacity_normal = 100;

x = random(probability);

if (x <= 1) {
   opacity = random(100);
} else {
opacity = opacity_normal;
}
 
dsp_418
Posts: 10
Joined: Mon Dec 05, 2005 6:53 am

Wed Apr 25, 2007 7:20 am

Thanks Nathan!
I was looking just for a script like this!
very handy

Who is online

Users browsing this forum: No registered users and 4 guests