ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random Motion only when opacity >= 20

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
mauro carlieriRandom Motion only when opacity >= 20
by on Jan 6, 2017 at 4:02:33 pm

Hi there,

I have a light, which intensity is linked to audio track (via soundkeys)
I need the light to random change position (only x and Y) everytime the intensity is >=30.

I am trying with no success ☹



PLEASE HELP...



Return to posts index

mauro carlieriRe: Random Motion only when opacity >= 20
by on Jan 6, 2017 at 4:05:54 pm

I need something like dan ebberts expression :

holdTime = .5; //time to hold each position (seconds)
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];

seed = Math.floor(time/holdTime);
seedRandom(seed,true);
random(minVal,maxVal)

but instead of evry .5 sec, evrytime light intensity is >= 20



Return to posts index

Dan EbbertsRe: Random Motion only when opacity >= 20
by on Jan 6, 2017 at 7:23:48 pm

It's not at all clear (to me at least) what you're asking for. Does the layer move to a new random position every time the opacity goes from below 20 to above 20, or is it something else?

Dan



Return to posts index


mauro carlieriRe: Random Motion only when opacity >= 20
by on Jan 7, 2017 at 1:43:10 am

Yes, exactly.
I need the light layer to move to a new random position(only X and Y) everytime the light intensity is <=20. It must hold that position until the light intensity goes under 20 again..
i hope is clean now.. Thanks 😁😁
Mauro



Return to posts index

Dan EbbertsRe: Random Motion only when opacity >= 20
by on Jan 7, 2017 at 6:03:13 am

Something like this maybe:


P = lightOption.intensity;
threshold = 20;
trig = false;
for (f = timeToFrames(time); f >= 0; f--){
tCur = framesToTime(f);
v = P.valueAtTime(tCur);
if (trig && (v > threshold)) break;
if (v <= threshold) trig = true;
}
t = trig ? framesToTime(f+1) : 0;
seedRandom(t,true);
minVal = [0.1*thisComp.width, 0.1*thisComp.height];
maxVal = [0.9*thisComp.width, 0.9*thisComp.height];
xy = random(minVal,maxVal);
[xy[0],xy[1],value[2]]<b></b>



Dan



Return to posts index

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