Автоматические реакции на приближение в After Effects
Tutorial Expressions:
INFLUENCE POSITION
nullPos = thisComp.layer("NULL").transform.position;
objPos = transform.position;
maxDist = thisComp.layer("CONTROLLER").effect("Max Distance")("Slider");
strength = thisComp.layer("CONTROLLER").effect("Strength")("Slider");
dist = length(nullPos, objPos);
dir = normalize(objPos - nullPos);
moveAmount = strength * (1 - clamp(dist / maxDist, 0, 1));
newPos = objPos + dir * moveAmount;
newPos;
INFLUENCE TIME REMAP
nullLayer = thisComp.layer("NULL");
distance = length(nullLayer.position, transform.position);
maxDist = thisComp.layer("CONTROLLER").effect("Max Distance Time")("Slider");
strengthDist = thisComp.layer("CONTROLLER").effect("Strength Time")("Slider");
effectiveDist = clamp(strengthDist, 0, maxDist);
timeStart = 0;
timeEnd = 5;
clampedDistance = clamp(distance, effectiveDist, maxDist);
remapTime = linear(clampedDistance, maxDist, effectiveDist, timeStart, timeEnd);
remapTime;
EFFECTS ANGLE
nullPos = thisComp.layer("NULL").transform.position;
objPos = thisLayer.transform.position;
angle = -radiansToDegrees(Math.atan2(objPos[1] - nullPos[1], objPos[0] - nullPos[0])) + 180;
EFFECTS OPACITY:
nullPos = thisComp.layer("NULL").transform.position;
objPos = thisLayer.transform.position;
maxDist = thisComp.layer("CONTROLLER").effect("Max Distance")("Slider");
dist = length(nullPos - objPos);
opacity = 100 * (2 - 2 * clamp(dist / maxDist, 0, 1));
00:00 Intro
00:38 Influence Position
03:50 Influence Offset
05:26 Influence Time
07:10 Influence Offset
08:38 Influence Effects
11:30 Outro
| By
olly