ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

CreateNullsFromPaths expression alteration

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Robert Anderson
CreateNullsFromPaths expression alteration
on Jan 6, 2018 at 1:06:52 pm

Hi
I am playing around with the(window > ) "Create Nulls From Paths.jsx" extension added with CC 2018 update

I am trying to create a flower that moves whilst the base of the stem stays rooted on to that spot.

I have been successful to a point by using the NullsFromPaths plug in.

It creates the attached expression code on the stem path.

It creates the 2 nulls of course; [5.1.0] = bottom of stem and [5.1.1] = top of stem
It also creates 2 expression control effects (layer controls) on the layer that point to the two nulls at top of stem and bottom of stem.



So far to create the effect I want I have deleted the Layer Control for [5.1.1] = top of stem and deleted its reference from the code even though it didn't cause an error.
So by moving the flower layer the layer moves but the bottom of the stem remains linked to the remaining null a.k.a [5.1.0]

It does create the effect I like but I was wondering if I could go one step further, completely self contained, and use the createPath() method used in the plugin to create my own path where the bottom of stem is linked to (layer.position * -1)
So when I move the flower the stem moves in the opposite direction making it stay still while the flower moves. Then I could duplicate the flower self contained and modify them all much easier and do other expression based things with them.

Essentially wondering how I can modify the expression code so that top of stem / the flower moves where I want it to, while the base of the stem stays unmoved.

I'm sure what I am trying to do is probably not the 'right way' to do it but would make life a lot easier and allow me to develop this hobby-only animation project exactly the way I want to, if I could make it self contained and if someone knew how to do that.

If it helps I would be happy to and like to upload the project file.

var nullLayerNames = ["Shape Layer 2: Path 1 [5.1.0]","Shape Layer 2: Path 1 [5.1.1]"];
var origPath = thisProperty;
var origPoints = origPath.points();
var origInTang = origPath.inTangents();
var origOutTang = origPath.outTangents();
var getNullLayers = [];
for (var i = 0; i &lt; nullLayerNames.length; i++){
try{
getNullLayers.push(effect(nullLayerNames[i])("ADBE Layer Control-0001"));
} catch(err) {
getNullLayers.push(null);
}}
for (var i = 0; i &lt; getNullLayers.length; i++){
if (getNullLayers[i] != null && getNullLayers[i].index != thisLayer.index){
origPoints[i] = fromCompToSurface(getNullLayers[i].toComp(getNullLayers[i].anchorPoint));
}}
createPath(origPoints,origInTang,origOutTang,origPath.isClosed());


Return to posts index

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