Hey Hiro! I finaly got to test the expression and it wasn’t working so here’s a working one with the right steps:
- Make a null object and link you camera to it.
- add a dropdown menu and two sliders
- paste this expression in the position:
// Retrieve the selected direction and duration
var direction = effect("Direction")(1).value;
var duration = effect("Duration")(1).value;
var distance = effect("Distance")(1).value;
// Define movement parameters
var startPos = [0, 0]; // Starting position (relative to current position)
var endPos;
// Determine end position based on selected direction
switch (direction) {
case 1: // Bottom to Top
endPos = [0, -distance];
break;
case 2: // Top to Bottom
endPos = [0, distance];
break;
case 3: // Left to Right
endPos = [distance, 0];
break;
case 4: // Right to Left
endPos = [-distance, 0];
break;
default:
endPos = [0, 0];
}
// Determine current position using linear interpolation
if (time < duration) {
// Moving from startPos to endPos
ease(time, 0, duration, startPos, endPos);
} else {
// After duration, stay at endPos
endPos;
}
Here’s a screenshot of how it looks for me.