Quantcast
Channel: Adobe Community : Popular Discussions - After Effects Expressions
Viewing all articles
Browse latest Browse all 47983

controlling nulls with expressions

$
0
0

I am having an issue with an expression I'm working with.

 

I am trying to produce a dynamic graph (among other visualisers) that appears to be being controlled by a datastream - the artifical datastream is created by a handfull of sliders and a wiggle expression.

The graph is a simple line graph that works fine. This is created by following a null (MarkPos) that has its y position controlled by the master wiggle expression I mentioned before.

 

This next bit is where I am having problems:

 

I want to mark the lowest and highest points the line has reached on the graph by moving a dotted line, one for the low points and another for the high.

 

Just focusing on the bottom line;

I have the following expression attached to the line, that collects the current position of the null (MarkPos) and compares this with the current position of the line to see if it has moved any further downwards, if it has it moves the line to the new lower y pos. However, all that is happening is the line is following the null.

 

x = thisComp.layer("MarkPos").transform.position.valueAtTime(time)[1];

y = transform.position.valueAtTime(time)[1];

z = transform.position.valueAtTime(time-thisComp.frameDuration)[1];

 

if (x>y) {

[0,x]

} else {

[0,z]

}

 

After alot of debugging I now know the issue is with the else statement - all that its doing is offsetting the upwards movement by 1 frame - so how do you set a command of "keep your current y position" in this instance?

[0,1] just resets it to its start position, and its not possible to just have the "if(x>y){[0,x]}" bit without the "else {}".

 

Any suggestions fo how to fix this, or a better way to do it?


Viewing all articles
Browse latest Browse all 47983

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>