ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Luma Effector Map to Scale Shape

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Gonzalo Menevichian
Luma Effector Map to Scale Shape
on May 25, 2020 at 9:33:41 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];


Return to posts index

Robert Müller
Re: Luma Effector Map to Scale Shape
on May 26, 2020 at 8:01:39 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.


Return to posts index

Gonzalo Menevichian
Re: Luma Effector Map to Scale Shape
on May 28, 2020 at 12:21:21 am

Thank you so much!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2020 CreativeCOW.net All Rights Reserved
[TOP]