7 Replies Latest reply on Sep 28, 2011 6:47 AM by ingvarai

    How to save expression together with animation preset?

    ingvarai Level 1

      I am trying to understand expressions and animation presets.

      I have one single slider control, which controls the opacity of a layer, where the value is the slider value + slightly changed using an expression.

      I can save the slider control as an animation preset, but the expression gets lost.

      Yes, this is so basic that it can be, this is the way I like to learn. And as far as I know, expressions can be saved together with animation presets. I hope someone can tell me how!

        • 1. Re: How to save expression together with animation preset?
          Rick Gerard Adobe Community Professional & MVP

          Animation presets will apply only to a single layer. Put your expression control on the same layer that has the expression. Press U twice to reveal all properties set to something other than the default values, select everything revealed in the timeline and save as an animation preset.

          • 2. Re: How to save expression together with animation preset?
            ingvarai Level 1

            Thanks, it somehow works. I say "somehow" because when I use the effect on a new layer, and then delete the effect, I get a warning "Bad argument copuld not find effect named 'my new effect' - Expression disabled.

            I do not get this warning when deleting professional effects. And they use expressions, don't they?

            • 3. Re: How to save expression together with animation preset?
              Rick Gerard Adobe Community Professional & MVP

              As long as the expression only references the same layer that it's on you won't get this warning if you remove all of the animation including the expression.

               

              If your expression is tied to an expression control and you delete the expression control (say a slider) you'll get the warning. That's expected behavior. You'd get the same warning if you tied the expression to any value in any effect. For example if you tied opacity to Lens Flair Brightness with the following expression applied to opacity:

               

              effect("Lens Flare")("Flare Brightness")

               

              and you deleted the Lens Flair Effect the expression would break and you'd get the warning.

              • 4. Re: How to save expression together with animation preset?
                ingvarai Level 1

                Gerard, thanks for your patience with me.

                There is obviously something I do not get here.

                Let us say I want to create an effect, to be distributed to others, an effect that includes expressions. I have now made such an affect, let us call it MyOpacityTweaker. It has one slider that controls the opacity of the layer it belongs to. I can now load this effect in a new project, and it works!

                There are still a few things I do not get:

                1) The warning I mentioned above (I understand what you say, but "professional" effects do not generate warnings. Why is not the expression removed together with the effect, when the effect is removed from the layer?

                 

                2) Ticking the enabled / disabled flag for the effect has no influence, the slider will change the opacity regardless. Why?

                 

                In other words:

                Is there a way to make a "professoional" effect that includes expressions, an effect that behaves like the other effects in that it is enabled / disabled when the flag is ticked/unticked and that removes its expressions as well when it is deleted?

                Ingvar

                • 5. Re: How to save expression together with animation preset?
                  Mylenium Most Valuable Participant

                  Why is not the expression removed together with the effect, when the effect is removed from the layer?

                   

                  That - again - is "as designed" and expected behavior. An expression is "passive" code that only evaluates within its property/ sandbox. Or in other words: An expression can be written in such a way that it goes looking for external properties, but an expression applied to property A has no way of influencing property B. Other than that, if no prerequisites are in place to make an expression go looking for values of external properties, it simply doesn't care what happens in the rest of the world. Therefore deleting any effect or disabling it is nothing the expression ever would notice. If it has an active reference, then you get a warning, but not otherwise.

                   

                  Ticking the enabled / disabled flag for the effect has no influence, the slider will change the opacity regardless. Why?

                   

                  See my previous comment. Expressions look for property stream values, nothing else. The rest doesn't matter to them - that is, again, unless you tell them they should recognize it by adding more code like e.g. the isActive() or isObject() methods to check if something exists or adding conditionals like if(true){do this}else{do that}.

                   

                  Mylenium

                  1 person found this helpful
                  • 6. Re: How to save expression together with animation preset?
                    Rick Gerard Adobe Community Professional & MVP

                    The reason that the expression is not removed when you delete the slider is that the expression is only reading the slider value, the slider doesn't know that the expression is there. There's no reverse link.

                     

                    You can build more professional effects but that involves editing the xml file that tells AE what effects are applied. This still would not generate a reverse link to an expression.

                     

                    Enabling or disabling an effect only changes the way things are rendered. If you have keyframes on a Lens Flair Brightness and you disable the effect the Lens Flair will not render but the keyframe values will still be available to an expression. Again, there's no reverse link. Since an expression slider does not make a change in the pixel values of a layer turning the FX switch on or off will have no effect on an expression reading the value.

                     

                    The "trick" in creating an Animation Preset that uses expressions and is removed with the "effect" is removed from the Effects Control Window is to only write expressions for properties that are available in the effects used. You could do this by applying the Transform Effect, or the Levels Individual Controls Effect, or the CC Composite Effect to the layer and writing the expression there instead of placing your expression in the Layer's opacity property. Take a look at this screenshot.

                     

                    Screen Shot 2011-09-28 at 12.33.36 AM.png

                    • 7. Re: How to save expression together with animation preset?
                      ingvarai Level 1

                      Gerard,

                      this is what I needed

                      Ingvar