FORUMS: list search recent posts

F-Stop value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Richard Farkas
F-Stop value
on Jun 16, 2012 at 10:47:15 am

Hello,

I tried to create a preset that shows an F-Stop number in the corner. The F-Stop number is shown by a text layer, and source text is controlled by a slider control. I created an expression (see below), that partly works, but I think it’s too complicate. I used 10 F-Stop values: F1, F1.4, F2.8, F4, F5.6, F8, F11, F16, F22 and CLOSE. My goal is: if the slider value is equal or more than 0 but less than 10, the F-Stop value is F1. If equal or more than 10, but less than 20, in this case the text shows F1.4, ect.

Could anybody give some advice?

Thanks!

Richard


My expression:

n=effect("Slider Control")("Slider");
Math.round(n);
if(n==0){
"F1"
} else if(n==1){
"F1.4"
} else if(n==2){
"F2"
} else if(n==3){
"F2.8"
} else if(n==4){
"F4"
} else if(n==5){
"F5.6"
} else if(n==6){
"F8"
} else if(n==7){
"F11"
} else if(n==8){
"F16"
} else if(n==9){
"F22"
} else {
"CLOSE"
}


Return to posts index

Dan Ebberts
Re: F-Stop value
on Jun 16, 2012 at 4:24:34 pm

I'd do it like this:

n=effect("Slider Control")("Slider");
fStops = ["F1","F1.4","F2","F2.8","F4","F5.6","F8","F11","F16","F22","CLOSE"];
fStops[Math.floor(n/10)]


Dan



Return to posts index

Richard Farkas
Re: F-Stop value
on Jun 19, 2012 at 11:18:46 am

Thanks Dan, it works perfectly!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]