Activity › Forums › Adobe After Effects Expressions › Wiggle expression between 2 values only
-
Wiggle expression between 2 values only
Posted by Jane Cassidy on December 6, 2010 at 12:33 pmI hope I’m not reposting, I just can’t find the answer anywhere. Basically I want to switch a layer on and off randomly.
In order to do this I’ve added a wiggle expression to the opacity. This works but I need it only to use the values 0 and 100. Is there a way to have it only use these values or do I need to approach this issue differently?
Thank you.
Nithish Kumar replied 6 years ago 4 Members · 9 Replies -
9 Replies
-
Michael Szalapski
December 6, 2010 at 2:35 pmYou’ll want the result from your wiggle to be a variable and then use that variable in an if then statement.
– The Great Szalam
(The ‘Great’ stands for ‘Not So Great, in fact, Extremely Humble’)No trees were harmed in the creation of this message, but several thousand electrons were mildly inconvenienced.
-
Dan Ebberts
December 6, 2010 at 5:57 pmJust set the value to 50 and add an expression like this:
wiggle(1,50) < 50 ? 0 : 100
Dan
-
Jane Cassidy
December 6, 2010 at 11:19 pmI got it to work. Thanks a million for your help. Much appreciated.
-
Nithish Kumar
April 26, 2020 at 3:27 pmCan you explain the syntax of this expression ? Cause I’ve seen numbers inside the parenthesis of wiggle expression. Not outside.
-
Dan Ebberts
April 26, 2020 at 3:35 pmIt basically says if the wiggled value is less than 50, set the result to 0, otherwise set it to 100.
ThE ?/: syntax is an example of the JavaScript ternary operator, which is a compact form of if/else.
Dan
-
Nithish Kumar
April 27, 2020 at 7:05 amThank you so much, Dan..It was of great help as always…
Is there any detailed tutorial for Ternary operator that you can point me to…..?
-
Dan Ebberts
April 27, 2020 at 7:32 amThere’s not much to it really, this should cover it:
https://www.javascripttutorial.net/javascript-ternary-operator/
Dan
Reply to this Discussion! Login or Sign Up