Skip to main content
Participant
April 23, 2024
Question

How to manage the bottom layer in the hierarchy

  • April 23, 2024
  • 1 reply
  • 421 views

I don't understand how to make blocks that are 2 levels below the main composition play an animation when they cross the middle of the top composition?


I tried expression writing from the top composition to get low blocks coordinates, and from the lowest block to get its position[0] in the composition of the top level - nothing works!


Can anyone help, at least with advice or direction?


Sample project included.

This topic has been closed for replies.

1 reply

Legend
April 24, 2024

I hope you're trying to do something like that.

 

Scale Expression:

offset = 100;
mainCompWidth = comp('MAIN').width;
allBlocksWidth = comp('ALL_BLOCKS').width;
base = mainCompWidth + allBlocksWidth;
allBlocksPos = comp('MAIN').layer('ALL_BLOCKS').position[0];
blockPos = base - allBlocksPos - comp('ALL_BLOCKS').layer(thisComp.name).position[0];
middle = (mainCompWidth + allBlocksWidth) / 2;

scl = Math.min(linear(blockPos, middle + offset, middle - offset, 59.2, 80), linear(blockPos, middle + offset, middle - offset, 80, 59.2));

[scl, scl]

 

Participant
April 24, 2024

Hi!
Great, but a little bit not what I need.

In the DOT element (MAIN -> ALL_BLOCKS -> BLOCKS_nn -> DOT) I meant any animation, not just scale.

When every "BLOCK_nn" cross the middle of MAIN, the composition starts playing from the first frame (the original 'DOT' would have multiple elements and complex animation).


BLOCKS_nn compositions will be created by duplicating the original BLOCKS_01 in ALL_BLOCKS.

Maybe Time remaping can help?

Anyway, thanks 4 help!

Legend
April 25, 2024

You can use this expression for any property :

Rotation Expression:

offset = 100;
mainCompWidth = comp('MAIN').width;
allBlocksWidth = comp('ALL_BLOCKS').width;
base = mainCompWidth + allBlocksWidth;
allBlocksPos = comp('MAIN').layer('ALL_BLOCKS').position[0];
blockPos = base - allBlocksPos - comp('ALL_BLOCKS').layer(thisComp.name).position[0];
middle = (mainCompWidth + allBlocksWidth) / 2;

val = linear(blockPos, middle + offset, middle - offset, 0, -90);

val