Creative Communities of the World Forums

The peer to peer support community for media production professionals.

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 pm

    Working 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.com

  • Nick Vaka

    October 4, 2013 at 7:31 pm

    It’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.com

  • Anders Hattne

    October 4, 2013 at 8:27 pm

    Depending 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.zip

    Maybe there is an expression free way of doing this as well?

    http://www.ardillamedia.com

  • Kevin Camp

    October 4, 2013 at 8:44 pm

    i’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 & KRCW

  • Nick Vaka

    October 4, 2013 at 9:15 pm

    Thanks! This is exactly the expression I was looking for. Works like a charm.

    Nick Vaka
    Motion Graphics & Animation
    https://www.nickvaka.com

  • Nick Vaka

    October 4, 2013 at 9:16 pm

    Thanks 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.com

  • Anders Hattne

    October 5, 2013 at 8:56 am

    When 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-sub

    http://www.ardillamedia.com

  • Anders Hattne

    October 5, 2013 at 9:55 am

    Just realised that doesn’t quite work. But Kevin Camp had a similar idea that probably works. Gonna check that out!

    http://www.ardillamedia.com

  • Synnøve Ludvigsen

    February 12, 2015 at 9:55 am

    Hi 🙂

    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?

Viewing 1 - 9 of 9 posts

Log in to reply.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy