Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Use Checkbox to control the visibility of a layer after a certain time

New Here ,
Feb 02, 2023 Feb 02, 2023

Hey,

I'm useing the checkbox to control the visibility of a layer by using the expression in my project. The expression is below:

 

if(comp("WAR_MASTER").layer("PLAYER_IMAGE_NUMBER_CTRL").effect("CHECK IF USE TWO IMAGES")("Checkbox")==1) 0 else 100

 

It worked well, and I just wonder whether it is possbile to make the opacity of this layer change only after a certain time (says after 1 sec) once I clickthe Checkbox?

 

Thanks very much.

TOPICS
Expressions , How to
373
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 02, 2023 Feb 02, 2023

Something like this maybe:

cb = comp("WAR_MASTER").layer("PLAYER_IMAGE_NUMBER_CTRL").effect("CHECK IF USE TWO IMAGES")("Checkbox");
delay = 1.0;
if (cb.numKeys > 0){
  n = cb.nearestKey(time).index;
  if (time < cb.key(n).time) n--;
  if (n > 0){
    if (cb.key(n).value){
      t = time - cb.key(n).time;
      t > delay ? 100 : 0;
    }else{
      0;
    }
  }else{
    0;
  }
}else{
  cb.value ? 100: 0;
}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 02, 2023 Feb 02, 2023
LATEST

Thanks for your help. It seems not working on my project, but its' very inspiring.

I finnaly figured out another way to achieve what I'm after by useing a slider control with two key frames.

 

The two key frames are toggle hold keys on the opacity property, the first is 100% and the second is 0%, and the slider control is set on a null layer called "PLAYER_IMAGE_NUMBER_CTRL". The expression part is this:

 

a = thisComp.layer("PLAYER_IMAGE_NUMBER_CTRL").effect("Slider Control")("Slider").value;
if (a == 1)
{key(thisComp.layer("PLAYER_IMAGE_NUMBER_CTRL").effect("Slider Control")("Slider").value);}
else
{valueAtTime(time);}
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines