Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to set a layers scale property within a sliders expression

  • How to set a layers scale property within a sliders expression

    Posted by Caspar Wiegel on November 16, 2010 at 10:00 pm

    Hi,

    What I’m trying to achieve is a slider control that I can save as a preset and within the expression that is attached to the slider value I want to set the horizontal scale property of the layer the slider is applied to, and leave the vertical scale property as default 100.

    I’ve been looking at something like the following but it won’t work:

    temp = effect(“Slider Control”)(“Slider”);
    thisLayer.transform.scale(temp, 100);

    Any clues as to what I am doing wrong?

    Thanks a lot!

    Kevin Camp replied 15 years, 6 months ago 3 Members · 6 Replies
  • 6 Replies
  • Kevin Camp

    November 16, 2010 at 10:42 pm

    you were close…

    the last line just need to be the value that you want for the property, you don’t need to specify the property. and since this value is an array, it will need to be in brackets.

    so this is all you should need:

    temp = effect("Slider Control")("Slider");
    [temp, 100]

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dan Ebberts

    November 16, 2010 at 10:52 pm

    Also, your question implies that you want the expression to be on the slider, but that won’t work. The expression needs to go on the scale property.

    Dan

  • Caspar Wiegel

    November 17, 2010 at 7:27 am

    Hi Guys,

    Both thanks for your contribution, but the whole idea was that what Dan says to be impossible… Which is a pity! I just wanted to make a preset which I can drag and drop on any given layer and that that preset adjusts the scale and position of the applied layer.

    Thanks again for the replies.

    Caspar

  • Dan Ebberts

    November 17, 2010 at 8:06 am

    I didn’t mean that it was impossible. It’s just that the expression has to be on the scale property. After you create the expression, you just need to select both the slider and the scale property before you save your preset so that they’re both included.

    Dan

  • Caspar Wiegel

    November 17, 2010 at 6:09 pm

    Great!

    I don’t see the logic in this, but it works perfectly fine :).

    Thanks again! Cheers!

  • Kevin Camp

    November 17, 2010 at 6:26 pm

    in ae, it’s like the parent doesn’t tell the child what to do, the child just follows the parent…

    so one property can’t set another property directly, but you can set a property to look at another for data. so you set the scale property to look at the slider property for data.

    then when creating a preset, you just need to make sure you select all properties that you want contained in the preset… so you could have position, rotation, effect properties, etc. all contained in one preset.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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