Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Animating query based on mask.

Explorer ,
Jun 21, 2023 Jun 21, 2023

Hello,

Is there a possibility to animate the scale of a shape layer based on the mask path animation that I have on an adjustment layer ? So I have a few shape layers. And an adjustment layer on top. That has a mask. I have animated the mask path. If the shape layer comes inside the mask during the animation I want it to scale to 200. And when the mask animates and it's no longer on the shape layer I want the shape layer to reset scale to 100. I tried using some expression based on some R&D, but it's not working. Is there any solution.

 

I'm attaching my file below.

TOPICS
Expressions , How to
133
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 21, 2023 Jun 21, 2023

Probably something with sampleImage() or sourceRectAtTime() or possibly simple distance calculations if the mask is a regular shape. A screenshot would be more useful since I can't open your project here at home.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 21, 2023 Jun 21, 2023
LATEST

The easiest approach would be to use the Window/Create Nulls From Paths/Nulls Follow Points script, then delete all but one null on the Right Edge of the animated mask and one null on the left edge. You can get rid of the control Null. Then you use the X position of the nulls to create a pair of ease interpolation methods that use the width of the arrows as the tMin and tMax values and the X Position as t, then set the starting and ending value for scale on each arrow for value1 and value2.

 

Something like this would work:

 

 

t = thisComp.layer("Adjustment Layer 1: Mask 1 [1.0]").position[0];
t2 = thisComp.layer("Adjustment Layer 1: Mask 1 [1.1]").position[0];
tMin = position[0] + sourceRectAtTime().width;
tMax = tMin - sourceRectAtTime().width * 2;
v = ease(t, tMin, tMax, 100, 200);
v2 = ease(t2, tMax, tMin, 200, 100);
if (t < tMin)
	s = v;
else
	s = v2;
[s, s]

 

 

If you choose Nulls Follow Points and apply this to all shape layer Scale properties you should end up with arrows that scale from 100 to 200% as the shape layer mask passes. 

 

That should get you pretty close. You might have to modify the expression a bit to get the scale to accurately follow the leading and trailing edge of the mask. I don't have time to play with it to perfect it right now. 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines