Forums › Adobe After Effects › Using a layer’s scale to determine another layer’s position.
Using a layer’s scale to determine another layer’s position.
Nick Vaka
October 4, 2013 at 3:07 pmWorking on an animated blowfish in After Effects and wanted to see if someone had a quick and dirty solution for parenting his spikes’ position to his toro’s scale. Basically, as his body puffs out I’d like the spikes to stay near the edge of it without having to keyframe the position of each, while maintaining their original size (since simply parenting would scale the spikes up as well.
I know there’s probably an expression out there, but I haven’t the foggiest on where.
Thanks in advance!
Nick
Nick Vaka
Motion Graphics & Animation
https://www.nickvaka.comNick Vaka
October 4, 2013 at 7:31 pmIt’s a cartoony blowfish (Illustrator file). He doesn’t need volume, he’s just going to grow a bit and then I’ve got two subsequent character models of him more and more swelled up. I was thinking it’d just be nice to have his body well up a bit and then begin to expand without scaling the spikes themselves.
How would I do it in C4D out of curiosity (if that would work better)?
Thanks!
Nick Vaka
Motion Graphics & Animation
https://www.nickvaka.comAnders Hattne
October 4, 2013 at 8:27 pmDepending on the look of the blowfish I would use nulls parented to the blowfish’s body, then use the compTo expression to tie the spikes to the nulls. I made a quick experiment to try it out.. and thought it looked better when I added a bit of increase of scale to the spikes.
I’ll just attach my li’l project for you!
6602_blowfish.aep.zipMaybe there is an expression free way of doing this as well?
Kevin Camp
October 4, 2013 at 8:44 pmi’m not entirely clear on how you have things set up currently, but i think if you were to simply parent the spikes to the body, then scale the body, the spikes would stay in position relative to the body, correct?
but you’d like it if the spikes moved with the body as it scaled, but not scale themselves — or the scaling remained in dependent of the body?
if that is the case then you could try an expression like this to ‘cancel out’ the parent scale:
xScale = value[0]/parent.scale[0];
yScale = value[1]/parent.scale[1];
100*[xScale,yScale]with that expression, after the spikes are parented to the body, as the body scales up, the spkes will look like the stick to the body, but the scale will remain the same. you can still animate the spikes’ scales if separately if needed.
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCWNick Vaka
October 4, 2013 at 9:15 pmThanks! This is exactly the expression I was looking for. Works like a charm.
Nick Vaka
Motion Graphics & Animation
https://www.nickvaka.comNick Vaka
October 4, 2013 at 9:16 pmThanks for this! I might end up using the expression, but I’ve got a few other applications for this thing.
Thank you for your help!
Nick Vaka
Motion Graphics & Animation
https://www.nickvaka.comAnders Hattne
October 5, 2013 at 8:56 amWhen I woke up this morning, I had a simpler solution for this!
Delete the nulls. *You noticed my layers where all different colours? That way I can click the colour, and select label group, delete all nulls in one go.. or select all spikes etc!)Parent spikes to body and apply this expression to the scale
sub=thisComp.layer(“body”).transform.scale-[100, 100];
value-subAnders Hattne
October 5, 2013 at 9:55 amJust realised that doesn’t quite work. But Kevin Camp had a similar idea that probably works. Gonna check that out!
Synnøve Ludvigsen
February 12, 2015 at 9:55 amHi 🙂
I have a similar problem, and this looks like a good script for me, but I couldnt make it work.
I put your script on scale on the child layer and got this message:
After Effects warning: an expression was disabled as a result of an error.
Error at line 3 in property ‘Scale’ of layer 12 (‘tak’) in comp ‘comp name’
invalid numeric result (divide by zero?)Would you know why?
Log in to reply.