Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions follow the leader Expression(s) for 3D position and rotation(s)

  • follow the leader Expression(s) for 3D position and rotation(s)

    Posted by Mike Feu on August 10, 2008 at 6:15 pm

    OK, so I’m working on creating some movement using Dan Ebberts expression:

    start = 0; //start time of template motion
    end = 4.0; //end time of template motion

    t = thisComp.layer(“template”);
    offset = (t.effect(“offset”)(“Slider”)/100)*(index -1);
    travel = linear(t.effect(“travel”)(“Slider”)/100,start,end);
    t.position.valueAtTime(travel – offset)

    Awsome expression and controls, Thanks Dan’

    See sample image at link:
    https://www.animationage.com/Slide-1.jpg

    The motion path that the screens are on have subtle 3D attributes including z-space and rotation…. AND THERE ARE 3 POSITION POINTS (so the script is not able to have accurate spacing between points… I’m going to try to just work with 2 position properties to resolve this issue)
    So now I’d like to animate the X Y and Z rotations in the same way as the above expression allows for position (Not using auto orient, but rather the manual rotation of the null) For each object on the path the rotation will be different depending on where on the path it is. (Simply put: Each object will have the same rotation when it is on the same point on the path)
    Essentially, I’m animating a ‘train’ of live video screens along a path in 3D space:

    The images slide in from left to right and then ease to a halt… I can easily swap out the video (I’ve pre-comped everything) and slide thru the list to the frame I want.

    I’ll then have one of the frames zoom forward (I’ll parent the layer to another null for this)… It seems pretty straight forward but I’m having a hard time deciding the best way to make all this happen.

    Any and all ideas are welcome…

    Thanks for your help 🙂
    Mike

    Mike Feu replied 18 years ago 2 Members · 7 Replies
  • 7 Replies
  • Dan Ebberts

    August 10, 2008 at 7:17 pm

    I think if you change your template keyframes to roving it will solve the spacing issue. You should be able to use pretty much the same expression for the rotation properties:

    strt = 0; //start time of template motion
    end = 4.0; //end time of template motion

    t = thisComp.layer(“template”);
    offset = (t.effect(“offset”)(“Slider”)/100)*(index -1);
    travel = linear(t.effect(“travel”)(“Slider”)/100,strt,end);
    t.xRotation.valueAtTime(travel – offset)

    Notice that I changed “start” to “strt” (that’s an error I need to fix on my site) and “position” to “xRotation”.

    Hope that helps.

    Dan

  • Mike Feu

    August 10, 2008 at 8:01 pm

    Wow thanks for the Sunday reply…

    Let me start by saying I’m kind of a novice with expressions so forgive me if I seem a little ignorant as to how best to apply the expression…

    I’ve applied the expression to the y-rotation property and ended up with this error… (I changed ‘xRotation’ to ‘yRotation’)

    “AE warning: Class ‘Layer’ has no property or method named ‘yRotation’ Expression disabled”

    THere is a y rotation property on the template layer and it is animated…
    I’m not sure if I just applied it wrong…

    thanks again
    mike

  • Mike Feu

    August 10, 2008 at 9:07 pm

    Hey Dan,

    So I’ve been fiddling around am just making things a big mess

    When I add a layer (or remove one) from the comp everything goes haywire….
    It looks like I’ll need to do this within a pre-comp so there are no layers being added/subtracted in the herarchy during the process of development….

    The files don’t seem to be respecting the 3D? My start Keyframe is close to camera but does not seem to be being recognized as such…

    I’ve uploaded my project files (kind of big – 107meg)… If you have a moment and would be able to have a look I’d be eternally grateful 🙂
    It’s the ‘–TestDan’ comp

    https://www.animationage.com/Test-for-dan-folder.zip

    These are the slaves to the ‘template’ expression layer
    HD Footage Mortis 100
    HD Footage Mortis 101
    HD Footage Mortis 102
    HD Footage Mortis 103
    HD Footage Mortis 104
    HD Footage Mortis 105
    HD Footage Mortis 106
    HD Footage Mortis 107
    HD Footage Mortis 108
    HD Footage Mortis 109

    Layer ‘9 MASTER’ is pretty close to what I’m trying to make happen…(it can be used as the master layer if we can create the ‘train’ around it….)

    I can see how this is doable I just don’t have the chops to even come close…

    Thanks again again 🙂

    Mike

  • Dan Ebberts

    August 10, 2008 at 9:49 pm

    The expression assumes that the “train” layers will be at the top of the layer stack (layers 1 through n). I’m curious as to why you have the train layer anchor points moved so far from the layers?

    Dan

  • Mike Feu

    August 10, 2008 at 10:11 pm

    When i started out i was going a different (much simpler) route – Parent all the screens to a null and then rotate the null – the problem was that i couldn’t get the path right using that technique (I was stuck in a perfect merry-go-round circle) I never returned the screens to a basline anchor point…. I wonder if that is causing me some issues…

    Kool on the layers as top of the stack

    any thoughts on the files not respecting the 3D position as seen in Layer ‘9 MASTER’? This is the path i’m really trying to create…

    or on the rotate script giving me the error?

    whoo hoo
    Mike

  • Dan Ebberts

    August 10, 2008 at 10:40 pm

    The error is my bad – it should be:

    t.transform.yRotation.valueAtTime(travel – offset)

    I’m not sure what you mean about the files not respecting the 3D position unless it’s the offset anchor point issue.

    Dan

  • Mike Feu

    August 10, 2008 at 11:31 pm

    NICE! the rotation seems to be working 🙂

    The 3D thing is that the train doesn’t seem to start near camera…
    I’m going to try to rebuild without the Anchor points being so out of whack… I’ll bet that will resolve the issue….

    Thanks so much for your help with this
    I’ll let you know how it works out…. I’ll probably be up until the wee hours fiddling….

    thanks again

    You da man!
    Mike

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