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

Set Color Control using Dropdown Menu Control

Community Beginner ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Is there a way to set a colorpicker control with a dropdown menu in the "Essential Graphics"?

I'm making a Motion Graphics Template, where the user can choose between a "Correct" and a "Wrong"-animation via a drop down menu.

Icolorchange on dropdown.png


I want the color of the animation to change to red or green, when the user picks an option in the dropdown menu. But I still want the user to be able to choose a custom color.

Is this possible?
(This is the same issue if I would make a "reset values"-button for the user.)

TOPICS
Expressions

Views

1.4K

Translate

Translate

Report

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
Enthusiast ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

yes it's possible, add a checkbox control for a "color override"

expression would be something like: if color override is false, if symbol is correct then color is #0000ff else if symbol is wrong then color is #ff0000

if color override is true, then use color control.

 

sorry in a rush so can't write out the expression fully but shout if you get stuck.


Regards, aTomician

Votes

Translate

Translate

Report

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 Beginner ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Ah okay. So I will have to make a seperate button, to make the override?
I can not just make an expression to check for "Dropdown Menu change"?

Votes

Translate

Translate

Report

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
LEGEND ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Contrary to what @aTomician wrote an extra control would not be necessary. Expressions evaluate strictly in the order they are written out, so all that would be required to allow a custom color is to place it at the end of your other code. However, of course there are usability considerations here. Without an extra checkbox the user can always override the color regardless of the state of the dropdown and that may not be desirable. So indeed I would add that little checkbox as a safeguard.

 

Mylenium

Votes

Translate

Translate

Report

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 Beginner ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

Thanks for your replies.
But the most user friendly solution is if the drop down menu could change the color picker itself (but only on change - not every frame).
In this way, the following would work:

  1. The user chooses "Wrong" from drop down - the color picker changes to red (red animation)
  2. The user chooses blue from the color picker (blue animation)
  3. The user changes back to "Right" from drop down - the color picker changes to green (green animation)

    Isn't that possibble?

Votes

Translate

Translate

Report

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
Enthusiast ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

I'm interested in this @Mylenium  - how do you achieve it without an extra control?  How does expression evaluation order make any difference - as far as I can tell, if the color is set by expression it's impossible to change it from the front end.  Be interested to see any examples.


Regards, aTomician

Votes

Translate

Translate

Report

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
LEGEND ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

This is not possible. There is no onChange() event in expressions and what you want would cause a causality loop/ cyclic redundancy loop that cannot be resolved in the expression itself because it simply does not know what the controls' default state would have to be. This needs to be all included in the expression itself and hard-coded as well as structured accordingly. That's why you have to use multiple controls.

 

Mylenium

Votes

Translate

Translate

Report

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
Enthusiast ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

As @Mylenium states, there are no event listeners in After Effects Expressions.  I have found a way to work what you want without extra controls, but it involves having a third dropdown property called "custom".  See screenshots below.

 

However this way doesn't update cleanly in Essential Graphics and I would recommend against using this in a MOGRT, just in case you were thinking of.  AE expressions are limited I'm afraid - I often have to add some extra controls to EG to keep things working reliably.  IMHO I think you're better off adding a checkbox, I know it can feel clunky but in the limitations of AE, I think it's the most reliable option.

 

TheArmordillo_0-1669218550398.png

TheArmordillo_1-1669218572937.png

 

TheArmordillo_2-1669218590879.png

 


Regards, aTomician

Votes

Translate

Translate

Report

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
LEGEND ,
Nov 23, 2022 Nov 23, 2022

Copy link to clipboard

Copied

LATEST

You are not supposed to use self-references with "this". You may want to review the pertinent section in the online help:

 

https://helpx.adobe.com/after-effects/using/legacy-and-extend-script-engine.html

 

The rest really isn't that complicated. Since expressions will always return the last valid result of a function, you simply slap on your custom colors after all the dropdown code.

 

if(effect("Checkbox" == 1){use this color}

else {use result from dropdown magic}

 

Mylenium

Votes

Translate

Translate

Report

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