Skip to main content
brandonb96942845
Inspiring
March 22, 2023
Question

After Effects: Trigger change at timecode a condition becomes true?

  • March 22, 2023
  • 1 reply
  • 253 views

So the other week we figured out how to mimic the mouse-hover functions in Windows 10, by setting the opacity of a highlight to change when the mouse cursor is over it; now I'm looking to do something similar, but a tad more elaborate.

Now I'm building a mock webpage, and I want to do that thing where the an object enlarges a little when the mouse passes over it. I've already got the element in place, now I just need to see about making the size change.

The quick way is to use a variant of the solution provided by Dan Ebberts for the other question, which would set the scale to 100% when the mouse is over it, and to 95% when it's not. That's good for a "snap" effect, but I wanted to know if it would be possible to get it to change over the course of a set number of frames (in other words, when the PNG for the mouse cursor overlaps with the PNG for the web item, have the latter increase in scale by five percent, over the course of say ten frames, and then shrink back down over the same duration when the mouse cursor is no longer overlapping).

This is a very specific thing and I know it, but I'm slowly beginning to realize After Effects is a lot smarter than I thought (and WAY smarter than I am), so I'm trying to go all-in and do as much as AE can support.

This topic has been closed for replies.

1 reply

Dan Ebberts
Community Expert
Community Expert
March 22, 2023

This is quite a bit more complicated because the expression has to determine how long ago a triggering event happened. So, for example, if the cursor is currenly over the object, the expression needs to go back, frame by frame (using the time parameter of sampleImage) to see if the hover event has been true for at least ten frames, to calculate where it should currently be in the scale animation. It would be similar logic for the cursor moving away from the object. There's also the additional complication that the changing scale can change whether or not the cursor is overlapping, which might lead to some unexpected behavior.

brandonb96942845
Inspiring
March 22, 2023

Fair enough; I figured it was at least worth the asking. The "snap" effect we came up with using SampleImage for the mouse-hover function will work just fine. Thanks as always!