<p>Yes, that's perfectly possible, though it might be more work than just doing the animation yourself. </p>

<p>You'll have to find all of the changes that the presets apply to the layer and adapt them with expressions that respond to the value of the slider. To find all of the changed properties of a layer use <kbd>u</kbd><kbd>u</kbd> (double tap the <kbd>u</kbd> key). You'll have to apply preset 1, find all of the changes it makes, and write an expression that mimics them, then revert the layer and apply preset 2 and do the same thing. Then in your expression for each changed property you'd have:</p>

<pre class="lang-js prettyprint-override"><code>var ctrl = effect("Slider Control")("Slider");
if (ctrl === 0){
    value; //use the current value of the property
} else if( ctrl === 1){
    // the expression that mimics preset 1
} else {
    // the expression that mimics preset2
}
</code></pre>

CC BY-SA 3.0
2018-04-16T14:50:22.200Z
hmm, I 'think' I understand what you are saying (I do programming, but new to 'adobe' programming)... you mean - there isn't just an easy way to say to use the, let's say "stretch wipe" preset, and just say

if (ctrl == 1) {jump to preset 1}
if (ctrl == 2) ... etc

but rather, I'd have to figure out the coding/logic for each individual preset, and put *that* into my parantheses?
user6262902
CC BY-SA 3.0
2018-04-16T21:39:08.127Z
Presents are a way of applying pre configured changes to properties, animation and effects, so they change different things. So yes, you'd have to reverse engineer the preset and use expressions for each parameter the preset affects
stib
CC BY-SA 3.0
2018-04-16T00:15:07.757Z
2018-04-16T00:15:07.757Z
stib
<p>Is there a way to control whether or not an animation preset it applied to an item programmatically through After Effects?</p>

<ol>
<li>Let's say, for example, I have some sample text, that just says "hello world".</li>
<li>I then go and drag &amp; drop a "slide &amp; swoop" onto the hello world text.</li>
<li>I then add another transition, say a 'slide straight' from the effects &amp; presets</li>
<li>I then want to add a 'slider' control to the essential graphics panel, so if slider is set 0, none of the effects are applied. If it is to 1, it applies animation effect #1, and if it is set to to 2, it shows animation #2?</li>
</ol>

<after-effects>
Controlling animation presets programmatically
user6262902
# Controlling animation presets programmatically

(Asked by: username_0 on 2018-04-15)

Is there a way to control whether or not an animation preset it applied to an item programmatically through After Effects?

1. Let's say, for example, I have some sample text, that just says "hello world".
2. I then go and drag & drop a "slide & swoop" onto the hello world text.
3. I then add another transition, say a 'slide straight' from the effects & presets
4. I then want to add a 'slider' control to the essential graphics panel, so if slider is set 0, none of the effects are applied. If it is to 1, it applies animation effect #1, and if it is set to to 2, it shows animation #2?

**Tags:** after-effects


---

## 1 answers

### Answer by username_1 on 2018-04-16. Score: 0

Yes, that's perfectly possible, though it might be more work than just doing the animation yourself. 
You'll have to find all of the changes that the presets apply to the layer and adapt them with expressions that respond to the value of the slider. To find all of the changed properties of a layer use uu (double tap the u key). You'll have to apply preset 1, find all of the changes it makes, and write an expression that mimics them, then revert the layer and apply preset 2 and do the same thing. Then in your expression for each changed property you'd have:
var ctrl = effect("Slider Control")("Slider");
if (ctrl === 0){
    value; //use the current value of the property
} else if( ctrl === 1){
    // the expression that mimics preset 1
} else {
    // the expression that mimics preset2
}

> **Comments:**
> **username_0**: hmm, I 'think' I understand what you are saying (I do programming, but new to 'adobe' programming)... you mean - there isn't just an easy way to say to use the, let's say "stretch wipe" preset, and just say  if (ctrl == 1) {jump to preset 1} if (ctrl == 2) ... etc  but rather, I'd have to figure out the coding/logic for each individual preset, and put *that* into my parantheses?  
> **username_1**: Presents are a way of applying pre configured changes to properties, animation and effects, so they change different things. So yes, you'd have to reverse engineer the preset and use expressions for each parameter the preset affects  

---

