ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Control checkbox status with slider value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Juan Martín Miranda
Control checkbox status with slider value
on Mar 14, 2014 at 3:19:31 pm

Hey guys! I'm a newbie in the world of expressions and I'm finding them very useful in terms of rigging a 2D character. Basically I've been trying too figure out a way to control the ON/OFF state of a checkbox depending on the value of a slider. For example: if the value is specifically 0, the checkbox state is ON. With every other value, te state is OFF. I've gathered a few codes I found and made this sort of Frankenstein code, but it doesn't work. Can you give me any help?

It's the head of a character, the slider controls 3 different positions and there are 3 different checkboxes that control 3 separate layers of eyebrows. The idea is to link each head position with the matching eyebrow layer visibility.

Thanks!

if effect("HEAD")("Slider") == 0 {effect("EYEBROW ON/OFF")("Checkbox") == 1)} else {effect("EYEBROW ON/OFF")("Checkbox") == 0)}


Return to posts index


Dan Ebberts
Re: Control checkbox status with slider value
on Mar 14, 2014 at 4:19:22 pm

Your checkbox would just need an expression like this:

thisComp.layer("Head").effect("Slider Control")("Slider")==0

Dan



Return to posts index

Juan Martín Miranda
Re: Control checkbox status with slider value
on Mar 14, 2014 at 5:40:59 pm

Thanks a lot Dan! Works perfectly. It's a so much simpler code than I tought.


Return to posts index


Nuwan Thilina
Re: Control checkbox status with slider value
on Mar 25, 2019 at 4:29:37 am

Hello, I have a hard time trying to make a modification to this valuable script. Tired for hours no luck ☹
Anyone can help me with it?

Here is what I want to achieve

If slider value is 1,2,3,4,5,6 checkbox should be On If not OFF

Thank You,
Your help is highly appreciated.


Return to posts index

Dan Ebberts
Re: Control checkbox status with slider value
on Mar 25, 2019 at 6:56:52 am

LIke this maybe:

s = thisComp.layer("Head").effect("Slider Control")("Slider").value;
s == 1 || s == 2 || s == 3 || s == 4 || s == 5 || s == 6


Dan



Return to posts index

Nuwan Thilina
Re: Control checkbox status with slider value
on Mar 29, 2019 at 3:11:53 am

Thank You, Dan, Learned a lot from you. Always comes in to help in difficult situations.
Also done some research based on your codes. And found an amazing resource. I think this will help other newbies like me to adjust the code bit.

https://www.w3schools.com/js/js_operators.asp

Thanks Agian,
Nuwan T.


Return to posts index

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