0

I have a shape layer and I want to animate position x using this expression

x=clamp(thisComp.layer("Control Values").effect("Value Bar 1")("Slider"),0,100);

Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x))
[x, value[0]]

but he shows expression result must be of dimension 2. not 1 enter image description here

where is the problem???

1 Answer 1

1

On the second line: Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x)) returns a value. Since expressions use the first line that returns a value as the value of the property it is trying to use the result of that line as the value for position, and since it only has one dimension it's causing an error.

Change that line to

x = Math.round(easeOut(time,inPoint+0.53,inPoint+1.8, 0, x));

(don't forget the semicolon at the end).

What the amended line is doing is taking the result of the Math.round() function and updating the value of x with that result.

Just as best practice, you should also use a let on the first line, i.e.

let x = clamp(thisComp.layer("Control Values").effect("Value Bar 1")("Slider"),0,100);

The let keyword assigns x as a variable, but restricts it in scope to the local expression, so that it doesn't possibly pollute other expressions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.