Copy link to clipboard
Copied
Hi
I have a comp within a comp. The inner comp has a static character moving on a circular path, Auto-Orient on.
The character has some other characters following it using the following expression:
var P=thisComp.layer(index-1).transform.position;
var D=thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider")*thisComp.frameDuration;
P.valueAtTime(time-D)
It all works well. However, there are about a dozen times where the followers forget that Auto-Orient is on and un-orients themselves - not all at once - one here and there, sometimes 2 or 3 followers at once - almost randomly, although it happens in the same places when I scrub through.
The leader character is fine - no flipping out of Auto-Orient mode.
The end result is 90% of the time it looks great, but the rest of the time it's flickering as different images flip for a frame or two.
I can't see any rougue keyframes that might be doing this.
The other weird thing is that it seems to do it more often when play from the main project comp. When in the inner comp, it still does it, but not as often.
Any idea what might be causing this?
Thank you.
I see a couple of organizational problems with your project. The first and most obvious problem is that you put an effect control slider on an adjustment layer. Effects Control sliders should not be on adjustment layers unless they are controlling effects on that adjustment layer. It's a waste of a layer that gets looked at when rendering.
Second, your expression is recursive. You should be pointing to one layer, your master animated bird layer, and adjusting the time delay based on the layer
...Copy link to clipboard
Copied
I forgot to mention that Auto-orient is on for all the followers.
Copy link to clipboard
Copied
hmm, that's an odd one. Could it be the valueAtTime is causing an issue with the auto-orient, as in it's trying to do both and that's causing the flipping. To be honest, I don't see why it should, but it might be worth seeing what happens if you disable it for the follow characters.
It's also strange that it happens randomly. Can you try moving through the timeline frame-by-frame and then rock back and forth across a point where one flips. A clue as to what's happening might emerge.
Copy link to clipboard
Copied
Thanks ShiveringCactus
The follows stop following when I disable valueAtTime.
I shouldn't have described it as random - it happens in the same places each time.
I've checked all the layers, and there's no rouge keyframes where it's happening.
I thought it might have had something to do with the vertex points, but I can make it happen when neither the leader nor any followers are on any vertexes.
Copy link to clipboard
Copied
Another oddity - if I play the comp from the main comp, the flips happen in different places to where they happen if I play back within the comp.
Copy link to clipboard
Copied
Are you using Collapse Transformations? And is there a camera in both comps? These would explain why they happen in different places, I think.
Can you post a screenshot of the whole project?
Andjust to clarify, I'd hadn't mean to suggest removing the valueAtTime, I'm suggesting removing the auto-orient on the follow layers and see if that makes a difference.
Copy link to clipboard
Copied
No Collapse Transformations. I just tried it with them trurned on, and same issue.
I'm new to AE, but I'm working in 2D, not 3D, so does that mean no cameras at all? I can't see a movie camera icon in the preview window.
Lol! I totally misunderstood re valueAtTime. Just tried turning Auto-Orient off, and the problem goes away, but I'm left with un-oriented characters.
I've attached 2 screenshots - I hope I've captured the relevant info. the first shows it behaving correctly, then misbehaving 1 frame later - the last two baby doves have flipped out of auto-orient
Thank you!
Copy link to clipboard
Copied
(Each follower dove has that same expression)
Copy link to clipboard
Copied
I feel like I'm missing an obvious solution. But try this: if the original bird does not flip at any point, try using a second valueAtTime expression to the follow bird's orientation/rotation.
I've also spotted your lead bird's scale is -20 % in the X value (as opposed to a positive 20%), was that to get it to face in the correct direction originally?
Copy link to clipboard
Copied
I don't remember setting to -20, but yeah - it looks like it was too getting it facing the correct way.
re the expression, do you mean for me to keep the original valueAtTime setting in, like this?
P.valueAtTime(time-D);
P.valueAtTime(thisComp.layer("Bubba Dove Leader").content.position);
I'm very new to expressions - the above is throwing an error - so does:
P.valueAtTime(thisComp.layer("Bubba Dove Leader").position);
Am I close to what you meant?
Thank you!
Are any of you guys available as consultants? I'm releasing a song next week and need to get this video for it done in the next few days. I'm happy to make the video myself, but I'd feel better about paying someone to help answer my 10,000 questions.
Copy link to clipboard
Copied
I'm sorry, I've been replying while nowhere near my PC, so it's all from Can copy the 3xpression almost exactly, but you want to change the .position to .rotation. Now that's assuming the rotation value changes when auto-orient to path is applied.
Seeing as we're getting stuck here, can you post the comp or DM me a link and I'll take a look.
Copy link to clipboard
Copied
Thank you ShiveringCactus - I've DM'd you a link.
Copy link to clipboard
Copied
Just to clarify - the comp is 2D (I saw a few "flip" problems with 3d work on Google).
Copy link to clipboard
Copied
I see a couple of organizational problems with your project. The first and most obvious problem is that you put an effect control slider on an adjustment layer. Effects Control sliders should not be on adjustment layers unless they are controlling effects on that adjustment layer. It's a waste of a layer that gets looked at when rendering.
Second, your expression is recursive. You should be pointing to one layer, your master animated bird layer, and adjusting the time delay based on the layer index. Dan Ebberts has the solution for you over at Motionscript.com.
I would put the expression control slider on the bird layer and use this expression:
src=thisComp.layer("Bird 1");
delay = thisComp.layer("Bird 1").effect("Delay")("Slider"); //number of frames to delay
d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d)
You could add some randomness to the delay by modifying the expression with a random number. As long as the original motion path is clean, that should solve your problem.
Copy link to clipboard
Copied
Thank you Rick! The Dan Ebberts expressions are doing the trick, and I'll experiment with moving the slider to the bird layer tomorrow.
Copy link to clipboard
Copied
The expression works really well Rick, and the slider on the lead character makes spacing the followers easy. Thank you.
However, I'm trying to get the followers to follow the rotation of the leader (not at the same time it rotates, but in the same place in the path it rotates).
Adding the extra line at the end is throwing an the error "expression result must be of dimension 2 not 1":
src=thisComp.layer("Leader");
delay = thisComp.layer("Leader").effect("Delay")("Slider");
d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d);
src.rotation.valueAtTime(time - d);
What is wrong with that expression please?
Copy link to clipboard
Copied
If you are applying that expression to position you have to delete the last line.
If you are applying that expression to rotation then you need to delete the next to the last line.
If the layers have auto-orient to path turned on you don't need to fiddle with rotation.
If you need further help please embed a screenshot showing the modified properties of the layer giving you problems. Select the layer, press 'uu', and embed the image. If you can't see it when you make your post it's a pain for us to look at it.
You also need to spend some time with the User Guide and the AE user manual and learn how to write expressions and what arrays are.
* The "Drag & Drop here..." area is buggy and should not be used to share images. Please use the toolbar or just drag your images to the reply field.
Copy link to clipboard
Copied
Thank you Rick. I've completed some expression tutorials today.
I've managed to achieve what I wanted: as well as auto-orient, I wanted the leader to change their z orientation at a particular point on the path, and the followers to do the same when they each get to that point.
I was misunderstanding expressions in that I thought you could set a property from an expression in any other property's expression box.
So now, in my position expression box, so the followers follow the leader's postion once they arrive at the point where the leader's position changed, I have
src=thisComp.layer("Leader");
delay = thisComp.layer("Leader").effect("Delay")("Slider");
d = delay*thisComp.frameDuration*(index - 1);
src.position.valueAtTime(time - d);
And in my orintation expression box, so the followers follow the leader's orientation once they arrive at the point where the leader's orientation changed, I have
src=thisComp.layer("Leader");
delay = thisComp.layer("Leader").effect("Delay")("Slider");
d = delay*thisComp.frameDuration*(index - 1);
src.orientation.valueAtTime(time - d);
So I'm understanding, for each property's expression box, new variables have to be declared, right? I can't use a variable from another expression box ie the variables aren't global, right?
Thank you