Copy link to clipboard
Copied
Hey there! I am trying to create an mogrt where an anchor point value can be set to a pre-defined value based on a slider.
I have parented the layer I want to move to a null object and applied the following expression to my null, bu it is not working. What am I doing wrong?
// variables
var select = thisComp.layer("Null 3").effect("Slider Control")("Slider");
var x = thisComp.layer("Null 3").anchorPoint[0];
var y = thisComp.layer("Null 3").anchorPoint[1];
//calculations if (select == [1]) {y= "-800";} else {y = 0;}
// output //
[x,y]
There are several flaws in your thinking.
Let me start with the ease operator. You need to add some kind of timing to make an interpolation method work. The syntax is:
x = ease(t, tMin, tMax, value1, value2);
t is the time, tMin is the start time, tMax is the end time, value1 is the start value, value2 is the end value. You can define time as frames or seconds and use thisLayer.inPoint as the starting time.
Using a slider for 3 different states is also not a good idea. From the movie you upl
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can create 2 sliders on the layer, 1 for each axis. Hope this helps.
var sX = effect("SliderX")("Slider");
var sY = effect("SliderY")("Slider");
value+[sX,sY];
Copy link to clipboard
Copied
Here's a screenshot!
Copy link to clipboard
Copied
Thanks mengopoo, can you show me how that would fit into my expression?
Copy link to clipboard
Copied
Before that, may I ask what did you want to achieve with calculations if (select == [1]) {y= "-800";} else {y = 0;} or as per your screenshot, the ease() function?
Copy link to clipboard
Copied
I need to set the achor point to a specific location based on the slider position.
Slider Position 0 - Anchor Point [0, 0]
Slider Position 1 - Anchor Point [0, -800]
Slider Position 2 - Anchor Point [0, 600]
etc.
Copy link to clipboard
Copied
The ease function was included so that the move to the new postion would be smooth.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are several flaws in your thinking.
Let me start with the ease operator. You need to add some kind of timing to make an interpolation method work. The syntax is:
x = ease(t, tMin, tMax, value1, value2);
t is the time, tMin is the start time, tMax is the end time, value1 is the start value, value2 is the end value. You can define time as frames or seconds and use thisLayer.inPoint as the starting time.
Using a slider for 3 different states is also not a good idea. From the movie you uploaded it looks like you want the graphic to move in, wait for a bit, then move out. If you need 3 different positions then the "if" statement should use a Dropdown Menu control and the expression should look like this:
ctrl = effect("Dropdown Menu Control")("Menu");
y = value[1];
if(ctrl == 1){
x = 800; // first x position
}
if (ctrl == 2){
x = 0; // second x position
}
if (ctrl == 3){
x = -100; // third x position
}
else{
x = value[0]; // if any other value keep original value for x
}
[x, y]
If you only have 3 menu positions in the Dropdown Menu then the else statement is not needed. I just included it to prevent expression errors.
When you want to include animation in a mogrt at the start or end of the graphic you usually use protected areas. You set up the comp to be longer than needed and then protect the first and last section. If you did that you could use the layer in point and out point to set the timing of the move in and move out and you would not need the dropdown menu control. If you want to keep the ability to animate inside Premiere Pro there are other techniques.
To give you the entire setup for this kind of move I need a lot more information on the design requirements. From the uploaded video, I don't see any need for any expressions or expression controls. All you need to do is animate the position of the graphic and set protected regions.
I hope this helps. You should spend some time with the MOGRT documentation.
Copy link to clipboard
Copied
Thanks Rick! That filled in the gaps I needed filled. I was able to use that to get my template working!
Thank you!
Copy link to clipboard
Copied
Thank you for the wonderful explanation Rick. You beat me to it! 🙂