Hey there, I'm working on writing an expression to animate parents between layers and I have an issue I'm not understanding.
Two layers, child and a parent. My expression is going into the position value of the child. Child has a check box and a layer control drop down.
with my current code (pasted below), things are working well, but I have one small issue. I can animate the code to work when its checked on, but once I do that, the child snaps to the position of the parent, wherever it happens to be, instead of moving with the parent regardless of where it initially started. I'm guessing I have to calculate the position at the current time for the parent or something, but not sure how to go about doing that.
I'm sure this has been posted before, so if its easier to direct me to a previous thread, please do. Thanks!
I'm not exactly sure what you're trying to do, but if you want to animate the checkbox so that the child follows the parent when the box is checked and holds its position when the checkbox is off, your expression will need to look at all previous checkbox keyframes and add up the total distance the parent traveled for all previous segments where the check box was on. Then, if the checkbox is currently on, add the amount of travel so far for the current segment. Definitely do-able, but a bit of work.