Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Luma Effector Map to Scale Shape

  • Luma Effector Map to Scale Shape

    Posted by Gonzalo Menevichian on May 25, 2020 at 9:33 pm

    Hi there!
    I using this expression to scale shapes when a Luma Comp matches them in space.
    My question is How the script could affect only in the scale Y axis, not in both?
    Thank you!!
    G

    var map = thisComp.layer("Luma_Effector");
    var pos = map.fromWorld(toWorld(anchorPoint));
    var sample = map.sampleImage([pos[0], pos[1]], [1, 1], true);
    var mapValue = linear((sample[0] + sample[1] + sample[2]) / 3, map.effect("Scale All Low Value")("Slider"), map.effect("Scale All High Value")("Slider"));
    [mapValue, mapValue];

    Gonzalo Menevichian replied 6 years ago 2 Members · 2 Replies
  • 2 Replies
  • Robert Müller

    May 26, 2020 at 8:01 am

    Hi,
    this should work for what you want:
    var map = thisComp.layer("Luma_Effector");
    var pos = map.fromWorld(toWorld(anchorPoint));
    var sample = map.sampleImage([pos[0], pos[1]], [1, 1], true);
    var mapValue = linear((sample[0] + sample[1] + sample[2]) / 3, map.effect("Scale All Low Value")("Slider"), map.effect("Scale All High Value")("Slider"));
    [value[0], mapValue];

    Explanation: Since scale needs 2 values (x and y) the value is stored in an array. You can recognize arrays by the “[” and “]” brackets and the different values are seperated by commas. To get a certain value from an array you reference its position again with square brackets and the corresponding number. Arrays always start at 0 so the first value is always something like “example[0]”. So with this in mind, I replaced the first part of your array with “value[0]”, which represents the entered x value, which is still keyframeable.

  • Gonzalo Menevichian

    May 28, 2020 at 12:21 am

    Thank you so much!

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