ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

if this then that random color expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
andrew blake
if this then that random color expression
on Aug 23, 2018 at 8:27:44 am

In after effects I want to change the color value in an effect when the keyframe of another layer = 1, preferably with easy ease out. if else, I would like the color to stay the same.
I have attached the code that I have so far (that I dont even know if it works).

thanks in advance.

if(thisComp.layer("Soundkeys").effect("Sound Keys")("Output 1")==1) effect("Saber")("Glow Color")


Return to posts index

Kalleheikki Kannisto
Re: if this then that random color expression
on Aug 24, 2018 at 9:44:54 am

The expression would go in the color value, so you need to set the color to another color. The easy way would be to pick it from another color value. Since you want an ease, you would have to calculate a percentage between two color value depending on how close the Soundkeys output is to 1. So if you wanted it to ease from 0.8 to 1, you'd calculate the mix using those two points as the 0-100 scale.

Another option is to animate the hue/saturation effect so that the color gets changed through effect strength. Or perhaps VCP Color Vibrance as an effect, that has the same color logic as Sabre, I believe.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

andrew blake
Re: if this then that random color expression
on Aug 25, 2018 at 3:43:21 am

I have the expression in the colour value of saber, I could have it cycle through predetermined colours, but I don't know how to that either.
I have soundkeys set to on/off trigger as that's the most appropriate for what I'm trying to achieve, and I meant ease between colours.


Return to posts index


Kalleheikki Kannisto
Re: if this then that random color expression
on Aug 25, 2018 at 2:38:53 pm
Last Edited By Kalleheikki Kannisto on Aug 25, 2018 at 2:41:09 pm

Let's start with the simple case. If you make a shape layer with a shape that has the color you want the effect to change to, then you should be able to do the following for saber color value. (I don't have saber installed on the computer I'm at so can't verify this.)

thisColor = *pick whip saber color here*;
otherColor = *pick whip shape layer shape color here*;
input = *pick whip soundkeys output here* ;
(input==0)?thisColor:otherColor


This should give you the original color when value is 0 and the new color when value is 1. If you want a random color, you could wiggle the color value of the shape.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

andrew blake
Re: if this then that random color expression
on Aug 27, 2018 at 8:04:18 am

I would like to get the shape to cycle colours, perhaps from red green and blue, I tried colorama, and it worked fine until I tried to do if soundkeys = 1, +120 else +0 in the phase shift tab, it would go to 120 on the beat, but would then go back to 0 after soundkeys went back to 0.


Return to posts index

Dan Ebberts
Re: if this then that random color expression
on Aug 27, 2018 at 3:31:51 pm

It sounds like you may not be aware that expressions have no memory, and no access to results calculated on previous frames. If your result depends on events that happened in the past, your expression will have to go look for them by looping back in time, frame-by-frame, using valueAtTime() to find the triggering events. In your case it sounds like your expression would have to find the number of times the SoundKeys value went from less than 1 to 1 and then either use that number as in index into a color table, or multiply it by some value for Colorama, etc.

Dan



Return to posts index

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