negative to positive value

Moderators: Disciple, zlovatt

Post Reply
User avatar
Ryberg
Posts: 7
Joined: October 21st, 2009, 4:30 am

This one should be very easy but my knowledge on expression scripts is very limited so I call for help.

A camera lens blur effects' blur radius is linked to a slider control and I would like it to turn the value up according to the sliders negative AND positive values, so:
Slider 50 = Blur radius 50
Slider 0 = Blur radius 0
Slider -50 = Blur radius 50

I wrote following nonsense in the blur radius attribute which obviously doesn't work

Code: Select all

x= (thisComp.layer("Adjustment Layer 3").effect("Slider Control")("Slider"))
if (x < 0) {*-1;
}
User avatar
Ryberg
Posts: 7
Joined: October 21st, 2009, 4:30 am

I managed to solve it, I'm happy again.

Code: Select all

x=(thisComp.layer("Adjustment Layer 3").effect("Slider Control")("Slider") *.35);
if (x < 0) x*-1;
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Or just:

Code: Select all

x = thisComp.layer("Adjustment Layer 3").effect("Slider Control")("Slider");
Math.abs(x);
Post Reply