Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Scaling depending on x position

  • Scaling depending on x position

    Posted by Phongo on June 13, 2007 at 12:01 pm

    Dan kindly supplied the code below:

    maxScale = 100;
    minScale = 5;
    minScaleDist = 100;
    pointer = thisComp.layer(“pointer”);
    d = Math.abs(pointer.transform.position[0] – transform.position[0]);
    ease(d,0,minScaleDist,[maxScale,maxScale],[minScale,minScale])

    It works great.. but as you can imagine I have 100’s of these images and suppose I wanted to be able to change one of those variables. Could i set it up so that i could edit the script in one place and have it apply to all those layers?

    Thanks again
    J

    Roland R. kahlenberg replied 18 years, 11 months ago 2 Members · 1 Reply
  • 1 Reply
  • Roland R. kahlenberg

    June 13, 2007 at 1:49 pm

    You’ll need Expression Controls –
    1)create a new comp and call it ExpressionController
    2)create a Null and leave it at the default name of Null 1
    3) apply effects>Expression Controls>SliderControl
    4) goto the Null’s effects pane and select its name
    5) Hit the Enter key on the main keyboard once and change its name from Slider Control 1 to maxScaleSlider Control. This slider will later be used to control the maxscale property of your Expression
    6) repeat twice and rinse after each time for Nulls 2 and 3. The only thing to be mindful of are the name changes for the Slider Controls for Nulls 2 and 3. minScaleSlider Control and minScaleDistScaleSlider Control for the Slider Controls that you apply for Nulls 2 and 3 respectively.

    // Start of Script
    maxScale = Comp(“ExpressionController”).layer(“Null 1”).effect(“maxScaleSlider Control”)(“Slider”);
    minScale = Comp(“ExpressionController”).layer(“Null 2”).effect(“minScaleSlider Control”)(“Slider”);
    minScaleDist = Comp(“ExpressionController”).layer(“Null 3”).effect(“minScaleDistScaleSlider Control”)(“Slider”);
    pointer = thisComp.layer(“pointer”);
    d = Math.abs(pointer.transform.position[0] – transform.position[0]);
    ease(d,0,minScaleDist,[maxScale,maxScale],[minScale,minScale])
    // End of Script

    HTH
    Roland Kahlenberg
    https://www.broadcastGEMs.com – Adobe After Effects project files
    https://www.myspace.com/rorkrgbspace

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