turning 'off' an expression

Moderators: Disciple, zlovatt

Post Reply
antvertigo
Posts: 4
Joined: September 22nd, 2009, 10:39 am

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
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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.
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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
antvertigo
Posts: 4
Joined: September 22nd, 2009, 10:39 am

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?
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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 ?
antvertigo
Posts: 4
Joined: September 22nd, 2009, 10:39 am

This is the error:
[attachment=0]expressionError.jpg[/attachment]
Attachments
expressionError.jpg
expressionError.jpg (216.31 KiB) Viewed 17607 times
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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
antvertigo
Posts: 4
Joined: September 22nd, 2009, 10:39 am

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'?
kobyg
Posts: 128
Joined: December 7th, 2007, 10:11 am

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.
Post Reply