Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random linking Wind Values

  • Random linking Wind Values

    Posted by Chris Joyce on January 14, 2016 at 2:27 pm

    Hey,

    Im using particular and think an expression would massively help me out. I am basically looking at randomising the wind values x,y,z but so only one is on at a time. For example if the x value is 1000 then y and z would be 0. If y was 1000 then x and z would be 0 etc etc. What I am looking for is to randomise which wind has a value of 1000 over time basically pushing my particles into a 3D grid like format.

    Thanks in advance.

    https://vimeo.com/chj214

    Chris Joyce replied 10 years, 6 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    January 14, 2016 at 2:53 pm

    I think I’d put the randomizing function in a slider somewhere and have it generate the random integers 0,1, or 2 and have an expression in each of the wind controls watching for its number to pop up in the slider (0 for x, 1 for y, 2 for z). The details depend on how you want the timing to work.

    Dan

  • Chris Joyce

    January 14, 2016 at 2:58 pm

    Thats kind of the way I was thinking. Im not too hot on expressions so unsure how to say if slider value ‘1’ x value 1000 etc. Not too worried about the randomness as I might key frame the slider.

    Could someone start me off.

    Thanks

    https://vimeo.com/chj214

  • Dan Ebberts

    January 14, 2016 at 5:31 pm

    Like this:

    s = effect(“Slider Control”)(“Slider”);
    if (Math.round(s) == 1) 1000 else 0

    Dan

  • Chris Joyce

    January 15, 2016 at 9:30 am

    Thanks for that Dan. Unfortunately I didn’t see it in time but managed to come up with a solution. This works perfectly if anyone if anyone else is interested.

    Code on Slider:

    holdTime = 0.5; //time to hold each position (seconds)
    seed = Math.floor(time/holdTime);
    seedRandom(seed,true);
    x = random(1,5)
    Math.round(x);

    Code for Wind X Value:

    // Make x equal to slider value
    x = (thisComp.layer(“Null 2”).effect(“Slider 1”)(“Slider”) )

    // Set position when x = 1
    if (x < 2) thisComp.layer(“Null 2”).effect(“Slider 2”)(“Slider”)

    // Set position when x = 2
    if (x > 1) if (x < 3) thisComp.layer(“Null 2”).effect(“Slider 3”)(“Slider”)

    // Set position when x = 3
    if (x > 2) if (x < 4) 0

    // Set position when x = 4
    if (x > 3) if (x < 5) 0

    // Set positionwhen x = 5
    if (x > 4) 0

    https://vimeo.com/chj214

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy