Page 1 of 1

turning 'off' an expression

Posted: September 22nd, 2009, 11:18 am
by antvertigo
Hi

http://www.vertigo.co.uk/cow/expressionHelp.jpg

As you can see from the image I have a letter 'O' being animated to keyframes from an audio layer via a couple of effects; Warp and Transform. My aim is; at a certain point I want the influence from the effects to fade down so that the letter appears in its normal state, whereupon the rest of the word will animate in.

To this end I have created some expression control sliders linked to some variables so that I can simply animate the sliders to zero when I want to remove the effect. However, it does not work with Transform. The neutral state of Transform/scale height is 100. I can't work out the code to return 100 when I want to fade out this effect. I know I probably don't have the most elegant solution, but any help would be appreciated, and if you can suggest better code that would be even better!

Antony

Re: turning 'off' an expression

Posted: September 22nd, 2009, 2:27 pm
by kobyg
Antony,

Try adding to your scale expression something like:

Code: Select all

 ... + (1 - SldTransf)*scale
This will make sure that when SldTransf reaches 0, you will get your scale (100% or any other value you have given you layer scale).

p.s.: If the maximum value of your SldTransf is some "MAX" value, and not 1, use something like:

Code: Select all

... + (1 - SldTransf/MAX)*scale
Koby.

Re: turning 'off' an expression

Posted: September 22nd, 2009, 10:05 pm
by kobyg
By the way, another way to do it is to use the "linear" function in order to interpolate between your "expression" value and the "non expression" value: scale
in something like:

Code: Select all

exp = (put your audio expression here, WITHOUT the slider);
nonexp = scale;
linear(SldTransf, 0, 1, nonexp, exp)
Koby.

p.s.: The above expression assumes that your slider takes values between 0..1

Re: turning 'off' an expression

Posted: September 23rd, 2009, 2:41 am
by antvertigo
Thanks for replying Koby

My expression now looks like this but returns an error:

Audio = linear(thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider"), 0, 30, 1, 4)
SldTransf = thisComp.layer("control").effect("SldTransf")("Slider")

thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")*(Audio*SldTransf) + (1 - SldTransf)*scale

I know I am being stupid somehow...

A

PS. I am not familiar with MAX, where do I find reference for that?

Re: turning 'off' an expression

Posted: September 23rd, 2009, 3:24 am
by kobyg
First, you have to have ";" at the end of each line.
Second, MAX was just my name for the maximum value of your slider. If your maximum slider value is 1, then you don't need that.
What is the error message you are getting ?

Re: turning 'off' an expression

Posted: September 23rd, 2009, 9:29 am
by antvertigo
This is the error:
[attachment=0]expressionError.jpg[/attachment]

Re: turning 'off' an expression

Posted: September 23rd, 2009, 9:55 am
by kobyg
Ah, that's simple:
change the last line to:

Code: Select all

thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")*(Audio*SldTransf) + (1 - SldTransf)*scale[1]
or this (using the linear function):

Code: Select all

tmp = thisComp.layer("Audio Amplitude").effect("Both Channels")("Slider")*(Audio);
linear(SldTransf, 0, 1,  scale[1], tmp)
Koby

Re: turning 'off' an expression

Posted: September 23rd, 2009, 10:10 am
by antvertigo
Thanks Koby, I will give it a try. So the principle is: if you want to turn 'off' an expression you set it up so you can do the 'opposite'?

Re: turning 'off' an expression

Posted: September 23rd, 2009, 10:20 am
by kobyg
Yes, something like that...
You actually prepare 2 expressions: one as your desired expression, and the second as the "opposite"/"base"/"unexpressioned" value, and then you use the linear function to change between them according to a slider.

Koby.