Skip to main content
Participant
December 2, 2021
Question

Expression with delay using position

  • December 2, 2021
  • 2 replies
  • 186 views

Hi, I have a doubt and im wasting too much time.

 

First of all, i have  this expression:

delay = thisComp.layer("Graphics delay").effect("Slider Control")("Slider"); //
d = delay*thisComp.frameDuration;
thisComp.layer("22%").transform.yPosition.valueAtTime(time - d)

 

So this expression its working well but i want to increase the value of the position to have the object a little bit up (only 42px up on yposition).

 

How can i fix that expression to have the delay and the yposition substract working well together?'

 

Thanks

 

This topic has been closed for replies.

2 replies

Community Expert
December 2, 2021

I don't know how this expression is working or where you are using it. 

 

yPosition does popup if you start typing but yPosition does not return the Y position of any position property. It is not defined.  You need to be using something like this and you have to generate an array:

delay = thisComp.layer("Graphics delay").effect("Slider Control")("Slider"); //
d = delay * thisComp.frameDuration;
newPos = thisComp.layer("22%").transform.position.valueAtTime(time - d);
vOffset = 200; // vertical offset
[newPos[0], newPos[1] + vOffset]

When you get in trouble with expressions it is always a good idea to start with the Understanding the expression language help page. 

Mylenium
Legend
December 2, 2021

Nothing fancy required. You could just add the -42 at the end. Other than that you can of course always employ any number of tricks like applying the expression to a Null or point expression control and parenting/ connecting the actual layer to that, then manualyl offset it or just the same using the Transform effect. Realyl depends on what specifically you have in mind.

 

Mylenium