ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Auto Offset (index) by moving a layer to another [x,y]?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Allan Ricarte
Auto Offset (index) by moving a layer to another [x,y]?
on Sep 20, 2018 at 11:54:31 pm

Hello guys,

I'm trying to do something with offset (index expression) and positioning [x,y], the idea is to move a layer to determined [x,y] and redo the index calculation again, but as we know it just works if you remove the layer from the comp itself

e.g: I have 40 layers in offset by index expression, i wanna move the layer 29 to another [x,y] and index the remaining 39 layers again

is there any way to do that?

Thanks


Return to posts index

Dan Ebberts
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 21, 2018 at 3:44:23 am

You want to change a layer's order in the layer stack with an expression, is that correct? There's no way to do that. An expression can't change anything except the value of the property hosting the expression.

Dan



Return to posts index

Allan Ricarte
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 21, 2018 at 5:52:20 am

Thanks for the answer! But i think i didn't explained very well, the idea behind is "Pick a card anywhere from the deck, and shuffle", a deck of card (the index offset), i want to take a card anywhere from it (move [x,y]) and organize the deck back in order without letting a gap between cards that i just took.

Of course doing this by animation, it should be easy, but I have to do this a lot, That's why i'm doing like a "Template", "Preset" for it

Hopefully, I've explained better

Thanks again for your time!


Return to posts index


Kalleheikki Kannisto
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 21, 2018 at 6:40:07 am

If you explain the purpose of what you are trying to achieve, maybe there's a different approach to the issue.

I mean, I guess you could calculate a new "index" number for each layer based on their x,y position. But I'm unclear as to why you would want to do this, or if it is even a good idea, not knowing the final objective.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Allan Ricarte
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 21, 2018 at 3:26:07 pm

That's the exactly what i'm looking for, calculate a new index value based on their new [x,y] position, I'm looking for a "Deck of Cards" magic, where someone takes a card (a layer) anywhere from the deck, and fill the gap between cards automatically, i was thinking to do something like that:

if yPosition value is not +1 in above layer (e.g: 540, 542, 543), it would subtract -1 from yPosition from all layers above, but If i need to do that again, it would take the new value for that formula instead

It seems very complex, but i think it would work for me

Please let me know if i'm still unclear about it, I'll do an animation to you guys better understanding.

Thanks for the help!


Return to posts index

Kalleheikki Kannisto
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 22, 2018 at 6:51:27 am

Ok, I get the idea.

Perhaps the position expression should be such that each card layer (apart from the bottom one) looks at the one below itself and adds +1 to the y position of that previous layer for the current layer, except under some predetermined condition, where the layer (card) below it has been removed (x or y position goes beyond a given range?), in which case it would look for the next layer down for y position. Since each layer will look at the result of the other layer's position this might ripple correctly through the stack. At least I think it would.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index


Kalleheikki Kannisto
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 22, 2018 at 6:57:10 am

A different approach:

Use a text layer to collect (in comma separated form, for instance) an array of only the cards that are visible in the stack and use the index number of the card for y position. That is, first generate the text layer content from some check as to whether the card is still in the stack and then for each card check if the card is in the text array and at which index position.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Kalleheikki Kannisto
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 22, 2018 at 5:47:32 pm
Last Edited By Kalleheikki Kannisto on Sep 22, 2018 at 5:51:55 pm

I got curious as to whether that would actually work, and it indeed does. Linked here's a rather basic application of that idea.

When a card is moved off the original position, the rest of the cards above it move down by one level (or index value) and thus drop down a position. There's no tweening here, that's another layer of complexity, but could certainly be added. It would also make more sense if the index was changed when the distance of the card from the original position exceeded the card dimensions.

While doing this I discovered that the expressions evaluate correctly only if the text layer is below the card layers. There's likely an order-of-execution explanation to this, which I wasn't aware of. I thought the property values are evaluated post-expression no matter the layers sequence but it seems this is not the case. At least not here. Maybe someone in the know can shed light on that.

12739_stackingtest.aep.zip

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Allan Ricarte
Re: Auto Offset (index) by moving a layer to another [x,y]?
on Sep 23, 2018 at 12:20:36 am

Thank you so much, the text layer idea was really helpful and smart, i didn't know you could do such a thing with expressions, Also this project will be helpful to me learn even more about that.

Once again, Thank you for your time!

Allan.


Return to posts index

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