🎉 Spring Registration is OPEN! 🎉
00
DAYS
00
HOURS
00
MINUTES
00
SECONDS
REGISTER NOW
Back to Blog Index

Make a UI Slider in After Effects with No Plugins

Creating a Custom UI Slider in After Effects, with Boundaries, Using the Clamp() function.

Showing off how your animations are made can give your work a nice professional feeling. And as a bonus, if you're trying to understand After Effects expressions better, the clamp() expression can be a great place to start. It's really easy to understand how this function operates inside of After Effects, and by learning it you can have an easy foundation of the language you'll need moving forward.

NOW, LET'S GET DOWN TO BUSINESS!

First, let's build our environment to set up a simple slider rig. Once we set up the slider in the composition panel we can start adding expressions to make the UI functional. Having a slider inside of your composition panel will help you test how your rigged layers look before moving into the animation phase.

For this rigged slider we are going to use two different types of expressions. We'll learn how to use the linear expression and how to use the clamp expression.

Plan out your UI element

Setting Up the CLAMP() Function

Let's start off by setting up the clamp function on the moving elements for the slider. Our goal is to have the circle in our example not move further than the line below it. Think of the line as the track, and we want the circle to stay on the track.

Move your sliding element as far left as you want it to go. Look at the X position value and notate this. Then move your sliding element all the way to the right and notate this value as well. Also, go ahead and write down the Y Position as well.

Now, let's get to writing the expression. Define our first variable "x" and then type the "clamp()" function. After Effects will be looking in the parentheses for three pieces of information. First, the input it should be reading information from. Second, the minimum value allowed. Finally, the maximum value allowed.

x = clamp(input,min,max);

Set the first value in the array by dragging the pick-whip to the X value in the position property. This is the input After Effects is going to read.

Just click, hold, then drag and drop

Next, type in the X Coordinates that you wrote down earlier. First, the furthest to the left value, followed by a comma. Then, the X position furthest to the right. There should now be three values filled out between the parentheses. Finish off this line by typing a semi-colon (;) to tell After Effects you're done.

x = clamp(transform.position[0],400,800);

After Effects has been instructed on how we are going to use the X position, and next we want to define how the Y position should work. Go to the next line and type y = (insert notated Y Position here) to lock the Y Position from moving up or down.

x = clamp(transform.position[0], 400, 800);
y = 800;

Last, and most importantly, we are going to wrap up this expression and tell After Effects what X and Y are now. Even though the expressions can be read, it will be looking for two values to fill in both the X and Y position values. This is because it started with two values and now needs your help wrapping up your expression, and pointing it to what those two values are. So, remember those variables we defined? Let's tell After Effects to use those.

x = clamp(transform.position[0], 400, 800);
y = 800;
[x,y];
// Or the following also works
x = clamp(value[0], 400, 800);
y = 800;
[x,y];

Done! If you go to the composition window you should now be able to grab the sliding element and drag it back and forth. Make sure the Y position does not move up and down, and the X position should stop at your minimum and maximum values you provided in the clamp() function.

Here's what it looks like to show off your cool work!

‍

EXPLORE ALL COURSES ➔

Dive into real-time 3D with our Unreal Engine beginner's course by Jonathan Winbush. Master importing assets, world-building, animation, and cinematic sequences to create stunning 3D renders in no time! Perfect for motion designers ready to level up.

Explore this Course âž”

Unlock the secrets of character design in this dynamic course! Explore shape language, anatomy rules, and motifs to craft animation-ready characters. Gain drawing tips, hacks, and Procreate mastery (or any drawing app). Ideal for artists seeking to elevate their craft.

Explore this Course âž”

Elevate your freelance motion design career with our guide to client success. Master a repeatable method for finding, contacting, and landing clients. Learn to identify prospects, nurture leads, and develop a thriving freelance philosophy amidst chaos.

Explore this Course âž”

Rev up your editing skills with After Effects! Learn to use it for everyday needs and craft dynamic templates (Mogrts) for smarter teamwork. You'll master creating animated graphics, removing unwanted elements, tracking graphics, and making customizable templates.

Explore this Course âž”

Stand out with Demo Reel Dash! Learn to spotlight your best work and market your unique brand of magic. By the end, you'll have a brand new demo reel and a custom campaign to showcase yourself to an audience aligned with your career goals.

Explore this Course âž”

Illuminate your 3D skills with Lights, Camera, Render! Dive deep into advanced Cinema 4D techniques with David Ariew. Master core cinematography skills, gain valuable assets, and learn tools and best practices to create stunning work that wows clients.

Explore this Course âž”

Master After Effects at your own pace with Jake Bartlett's beginner course. Perfect for video editors, you'll learn to create stylish animated graphics, remove unwanted elements, and track graphics into shots. By the end, you'll be equipped for everyday AE needs and more.

Explore this Course âž”

Revolutionize your Premiere workflow with customizable AE templates! Master creating dynamic Motion Graphics Templates (Mogrts) in After Effects to speed up your team's work. By the end, you'll craft easily-customizable templates for seamless use in Premiere Pro.

Explore this Course âž”
Your download is in your inbox!!!
Check your email (spam, too) for the download link!
Please check the spam folder if you don't see the message within a minute or two. Google likes to hide your downloads, sometimes.
Oops! Something went wrong while submitting the form.

Not sure where to start?

If you’re a beginner, here are some great courses to help you get started:

After Effects Kickstart

Dive into the fundamentals of motion design with our most popular (and recently updated) After Effects course.

LEARN MORE

Photoshop + Illustrator Unleashed

Master the basics of Photoshop and Illustrator and gain invaluable insights in this introductory level course.

LEARN MORE

Design Kickstart

An introduction to the design principles behind all great work.

LEARN MORE

More Advanced?

If you’re a more advanced student looking to up your game, here are some great options:

Animation Bootcamp

Learn the art and principles of creating beautiful movements in Adobe After Effects.

LEARN MORE

Design Bootcamp

Learn to design for motion in this intermediate-level, project-based course.

LEARN MORE

Cinema 4D Basecamp

Learn Cinema 4D from the ground up in this exciting introductory C4D course.

LEARN MORE

Now is the time to learn the skills you need to advance in your motion design career: