ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Triggering precomp animation via property (rotation, opacity, etc.)

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Emil Stefanow
Triggering precomp animation via property (rotation, opacity, etc.)
on Jul 31, 2019 at 4:43:15 pm

Hi folks,

Dan Ebberts' expression about triggering animations in precomps using markers is awesome and quite useful.
I'd like to ask though is it possible to trigger the animation in the precomp by "asking" for a property of the precomp in the main comp.

Let's say I have animated the precomp: it rotates by 90 degrees from Frame 30 to frame 60.
In the precomp itself I have a square which changes shape/color/size from frame 30 to 50. Marker "myAnim" is at frame 30 in the precomp. From frame 51 to 61 some minor scaling animation happens. The marker at frame 51 is "myAnim2".

I would like to tweak the expression by saying:

If the precomp reaches 10° rotation the precomp should play from marker "myAnim".
If the precomp reaches 80° rotation the precomp should play from marker "myAnim2"

So it's basically the Dan Ebberts expression but instead of using same-name triggers in the main comp I use the data from the precomp properties.

Is it possible?
Thanks so much!

Best regards
Emil


Return to posts index

Emil Stefanow
Re: Triggering precomp animation via property (rotation, opacity, etc.)
on Aug 19, 2019 at 1:56:21 pm

Hey folks...

Okay, a bit weird answering my own question but I found a solution by Dan Ebberts! it is not 100% as a wished but rather 99% 😉

Since I use sampleImage and a precomp/mask for the scaling animation, the idea with the sampleimage came in great and handy! Thank you Dan!!!

The solution is from this topic:
https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=2232...

Cheers
Emil

L = thisComp.layer("sampleLayer_A");
threshold = 0.00001;
trig = false;
ss = [width,height]/2;
for (f = timeToFrames(); f >= 0; f--){
t = framesToTime(f);
v = L.sampleImage(L.fromComp(toComp(anchorPoint,t),t),ss,true,t)[3];
if (trig && (v &lt; threshold)) break;
if (v >= threshold) trig = true;
}
t = trig ? time - framesToTime(f+1) : 0;


Return to posts index

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