Skip to main content
March 15, 2018
Answered

Help! How to use sliders to control graphic styles?

  • March 15, 2018
  • 1 reply
  • 2521 views

Hello,
I'm trying to make a motion graphics template in after effects to use in premiere with essential graphics. I'm having trouble to come up with a way to make changeable graphic styles that are controlled with a slider.

In this video, in the time range of 1:50 - 2:10, they do exactly what i want, but don't explain how to do it:

Learn to Create Custom Motion Graphics Templates in After Effects CC | Adobe Creative Cloud - YouTube

Can someone help me please?

Thank you

This topic has been closed for replies.
Correct answer Roland Kahlenberg

You group a set of layers that form a specific style - use Layer Lable colors and stack these layers together, in the Timeline, to help you identify them.

Link each of their respective Scale property to the value of the Slider Control. If the Slider matches the condition set in the Scale property then the Scale value is set to 100%. If the value of the Slider Control does not match the Expression Conditional, then set the Scale value to 0.

Something like this -

// start script

// declare my value

myValue = 1;

// identify slider to be used to check for its value

sliderValue = effect("Slider Control")("Slider");

// use conditional to check correspondence between slider value and my value

// set values to Scale, according slider value

if (sliderValue == myValue) { 100 } else { 0 }

// end of script

-------------------------------------------------------

You will also want to apply this Expression to the Slider, to limit its values to only integers-

// start script

sliderValue = Math.floor(effect("Slider Control")("Slider"));

// controls minimum allowable value to 1

if (sliderValue < 1) {1}

// controls maximum allowable value to 6

else if (sliderValue > 6) {6}

//if values are between 1 and 6, then use the value as it is

else {sliderValue}

// end of script

------------------------------------

You can use Edit>Copy Expression Only to copy the Expression and paste it on multiple, selected layers at one go. You wlil want to do this for the group of layers in the same set/style that you designed - essentially, they will all be using the same Expression to dictate their Scale values.

1 reply

Roland Kahlenberg
Legend
March 15, 2018

You will need to know Expressions. How comfortable are you with Expressions?

Very Advanced After Effects Training | Adaptive &amp; Responsive Toolkits | Intelligent Design Assets (IDAs) | MoGraph Design System DEV
March 15, 2018

I know the basics and can understand the syntax, but i don't know the keywords. In this case I have an idea of how to make it but don't know how to write it

Noel_Sufrin
Participant
April 15, 2019

You group a set of layers that form a specific style - use Layer Lable colors and stack these layers together, in the Timeline, to help you identify them.

Link each of their respective Scale property to the value of the Slider Control. If the Slider matches the condition set in the Scale property then the Scale value is set to 100%. If the value of the Slider Control does not match the Expression Conditional, then set the Scale value to 0.

Something like this -

// start script

// declare my value

myValue = 1;

// identify slider to be used to check for its value

sliderValue = effect("Slider Control")("Slider");

// use conditional to check correspondence between slider value and my value

// set values to Scale, according slider value

if (sliderValue == myValue) { 100 } else { 0 }

// end of script

-------------------------------------------------------

You will also want to apply this Expression to the Slider, to limit its values to only integers-

// start script

sliderValue = Math.floor(effect("Slider Control")("Slider"));

// controls minimum allowable value to 1

if (sliderValue < 1) {1}

// controls maximum allowable value to 6

else if (sliderValue > 6) {6}

//if values are between 1 and 6, then use the value as it is

else {sliderValue}

// end of script

------------------------------------

You can use Edit>Copy Expression Only to copy the Expression and paste it on multiple, selected layers at one go. You wlil want to do this for the group of layers in the same set/style that you designed - essentially, they will all be using the same Expression to dictate their Scale values.


Hi there, and thank you! This also worked for me with a minor tweak. I was getting a dimensional error on the expression when scale was pick-whipped to the slider, but by linking the slider to the Opacity parameter I was able to get it to work.

One item that may not be clear to folks unfamiliar with expressions - you'll need to assign each variable value to the Comp/Style it's associated with. For my simple template I was giving the user three template style choices, so the expression that lives within the Opacity parameter on each Comp/Style would begin with...

// declare my value for the 1st style

myValue = 1

// then the rest to the script...

// declare my value for the 2nd style

myValue = 2

// then the rest to the script...

// declare my value for the 3rd style

myValue = 3

// then the rest to the script...

I used your slider expression as-is but limited the choices to three and only changed the Opacity expression to:

// start script

// declare my value, where X is the number of the style choice

myValue = X;

// identify slider to be used to check for its value

sliderValue = thisComp.layer("Adjustment Layer 1").effect("Slider Control")("Slider");

// use conditional to check correspondence between slider value and my value

// set values to Scale, according slider value

if (sliderValue == myValue) { 100 } else { 0 }

// end of script

Again, very helpful, and better than anything I could find on YouTube today.