Community Forums

After Effects Training

+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    Jul 2012
    Location
    San Bernardino, California
    Posts
    5
    DT Subscriber

    Wiggle question? Expresions made Easy Tutorial

    I am using the expressions in the Expresions made Easy tutorial, to create a set of ocean waves. Everything works fine, but I want to add to an exsiting expression, to make the duplicated layers wiggle independently of one another.
    This is the expression

    transform.position + thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point") * (thisComp.layer("Control Layer").index - index) + transform.position[0]*index/10

    So duplicating a layer with this expresion offset the next layer and so on.

    How Can I add a wiggle expression to this so, the wiggle is different for each layer.

    I already tried adding an expression to the slider, and a different slider, and connecting a slider to a slider, and no luck at all.

  2. #2
    Join Date
    Oct 2006
    Location
    Digital Tutors HQ
    Posts
    2,470
    DT Staff

    Re: Wiggle question? Expresions made Easy Tutorial

    Hello travish! You can just replace the transform.position with your wiggle expression and everything should work great! Here’s a quick video on how you can do this and control the wiggle effect:


    Here is the expression:

    Code:
    wiggle(.1,20) + thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point") * (thisComp.layer("Control Layer").index - index) + transform.position[0]*index/10

  3. #3
    Join Date
    Jul 2012
    Location
    San Bernardino, California
    Posts
    5
    DT Subscriber

    Re: Wiggle question? Expresions made Easy Tutorial

    Awesome, awesome, awesome. Thank you so much. I new it was something as simple as that, but for the life of me could not figure it out.

  4. #4
    Join Date
    Jul 2012
    Location
    San Bernardino, California
    Posts
    5
    DT Subscriber

    Re: Wiggle question? Expresions made Easy Tutorial

    There was one more thing I was curious about. I have the waves and they're moving just fine. I would like to put objects between the waves. but doing this disrupts the expression for the waves. Is there a way I can use a layer name instead of the index number and still get the layers to offset?

  5. #5
    Join Date
    Oct 2006
    Location
    Digital Tutors HQ
    Posts
    2,470
    DT Staff

    Re: Wiggle question? Expresions made Easy Tutorial

    Hi travish,

    Yep, it's possible to do this with the layer name.

    I use the split command to break the layer name into pieces and then we can use those pieces like an offset.

    So if our layer name is 'wave_2'
    Code:
    nameSplit = name.split("_");
    [nameSplit[1],nameSplit[1]]
    nameSplit[1] will have the second piece of our layer name broken around the _ symbol.

    So if our layer was named 'wave_2_this_is_it' then the nameSplit array would have the following pieces:
    Code:
    nameSplit[0] = wave
    nameSplit[1] = 2
    nameSplit[2] = this
    nameSplit[3] = is
    nameSplit[4] = it
    Now, you can do this with any character, even with spaces. So if the layer was named 'Medium GrayBlue Solid 3' we could use the following:
    Code:
    nameSplit = name.split(" ");
    and these would be the values:
    Code:
    nameSplit[0] = Medium
    nameSplit[1] = GrayBlue
    nameSplit[2] = Solid
    nameSplit[3] = 3
    Does that make sense?

  6. #6
    Join Date
    Jul 2012
    Location
    San Bernardino, California
    Posts
    5
    DT Subscriber

    Re: Wiggle question? Expresions made Easy Tutorial

    So how can I work this in to the original expression for the waves, so I can still control the "distance between layers" with other objects in-between?


    wiggle(1,0.5) + thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point") * (thisComp.layer("Control Layer").index - index) + transform.position[0]*index/10

  7. #7
    Join Date
    Jul 2012
    Location
    San Bernardino, California
    Posts
    5
    DT Subscriber

    Re: Wiggle question? Expresions made Easy Tutorial

    would it be something like this.

    nameSplit = name.split("_")

    wiggle(1,0.5) + thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point") * (thisComp.layer("Control Layer")nameSplit{0},nameSplit{1}),nameSplit{2} + transform.position[0]*index/10

    I don't think I get it.

  8. #8
    Join Date
    Oct 2006
    Location
    Digital Tutors HQ
    Posts
    2,470
    DT Staff

    Re: Wiggle question? Expresions made Easy Tutorial

    Hi travish,

    You bring up a good point. I would begin by replacing all of the index of this lesson to the layer number.

    Code:
    nameSplit = name.split("_");
    layerNumber = nameSplit[1];
    
    wiggle(1,0.5) + thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point") * (thisComp.layer("Control Layer").index - layerNumber) + transform.position[0]*layerNumber/10
    What are you using the Control Layer's index for?

  9. #9
    Join Date
    Oct 2006
    Location
    Digital Tutors HQ
    Posts
    2,470
    DT Staff

    Re: Wiggle question? Expresions made Easy Tutorial

    If the Control Layer is always at the top, you can just replace that with a number. I also broke the 3d point into a new variable because it was difficult to read.

    Code:
    nameSplit = name.split("_");
    layerNumber = nameSplit[1];
    ctrl3Dpoint = thisComp.layer("Control Layer").effect("Distance Between Layers")("3D Point");
    
    wiggle(1,0.5) + ctrl3Dpoint  * (1 - layerNumber) + transform.position[0] * layerNumber / 10

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts