Activity › Forums › Adobe After Effects Expressions › Wiggle opacity randomly between 50 to 100 only?
-
Wiggle opacity randomly between 50 to 100 only?
Posted by Erik Eliason on January 18, 2014 at 11:23 pmHi, can’t find an answer to this on the world wide web so pardon me if I repeat post:
I’d like to wiggle the opacity but never under the value 50.
How would you write that script without using key frames?As I have your attention, for curiosity sake. How would you write wiggle opacity script only between 40 – 70?
Best //Erik
Erik Eliason replied 12 years, 3 months ago 3 Members · 4 Replies -
4 Replies
-
Dan Ebberts
January 19, 2014 at 12:40 amHere’s a pretty good approximation:
Set the opacity value to 75 then add this expression:
wiggle(3,25);
For your second example, set the opacity value to 55 and add this expression:
wiggle(3,15)
-
Darby Edelen
January 19, 2014 at 4:29 amHey Dan, I was wondering if you might have any insight into why the wiggle() function seems to be biased toward the lower values in the wiggle range.
I was doing something very similar to what the original poster requested the other day and found that even across a large sampling of the timeline well over 50% of the values were returning below the average.
If I increased the number of octaves then it became even more dramatic.
Does that seem like acceptable behavior or a bug to you? Personally I’d prefer the values to be evenly dispersed around the center but I may not be considering certain details required in implementation.
I wrote a little code to check the average value returned by a wiggle around 0° on rotation:
subf = 1;
fd = thisComp.frameDuration / subf;
f = thisComp.duration / fd;
r = thisComp.layer("Null 1").transform.rotation;
sum = 0;
for(x = 0; x < f; x++){
rf = r.valueAtTime(x * fd);
sum += rf;
}
sum / f;The subf variable (number of times to sample between frames) doesn’t seem to be very necessary so I’ve left it at 1.
I applied this to a text layer and I’ve only been able to find slight positive bias (+0.35) on 2 out of 13 layers when duplicating the layer to generate new seeds. Most of the layers have negative bias around -2. Maybe I’m just unlucky? 🙂
As an additional test I pointed this at a Null with a noise() expression applied:
f = 50;
noise(f * time);In this case the average never goes above ±0.03 when varying the frequency and rarely goes above ±0.01 while sampling once per frame. I started increasing the subframe variable in this case and the averages moved toward 0, even the -0.03 went down to -0.0001 at 20 subframe samples. Not surprisingly it looks like noise() centers around 0. I can’t imagine why wiggle() wouldn’t!
Darby Edelen
-
Dan Ebberts
January 19, 2014 at 8:13 amI hadn’t really noticed that, but I think you’re right–there does seem to be a bias. I don’t know why that would be the case, or what’s going on under the hood. It does seem strange though…
Dan
-
Erik Eliason
January 19, 2014 at 1:56 pmThanks Dan, that makes very much sense to me now.
I was thinking inside the box of writing a command but yeah, math huh 🙂
Reply to this Discussion! Login or Sign Up