20 minutes
Animation, Button, Playful, Sketch
In this tutorial you'll learn how to take a design comp, structure it into an animatable format, and then build a playful UI Animation.
This tutorial walks throug from a very early point in the design phase… Imagine you’ve envisioned this animation…
…and you’ve created the various steps as assets in Sketch, but haven’t prepared anything for Flow.
And, if you want to jump straight to the end…
We’re starting this tutorial right after having sketched out the concept for an animation, and well before we should import anything into Flow. Here’s what the Sketch file looks like:
This is a good layout of the various steps in the animation. From top to bottom we have:
Will we need all of these states to import into Flow? No… Here’s how to think about pulling this together.
The concept of this animation is a button. A button will be a single object, with one background… So, at a minimum we’ll need only 1 background shape – because we know that we can scale and change its color in Flow. Also, a button only needs a single title label – we can change its content in Flow as well. Finally, we will also need a copy of each of the unique assets (i.e. the face and the checkmark)
Make a new and add a new artboard sized to the button design – 300 x 70.
When you're bringing a Sketch file into Flow you'll notice the import window separates your selection by pages. So, it's generally good practice to organize the things you want to animate into their own pages.
Now, copy the following assets into the artboard you just created.
saved « YES, the longer label with the d
That’s it… We’re now ready to tweak these elements into animatability.
Always. Always. Always rename your layers appropriately. It helps when you’re animating, and even moreso when things go to code. And please, by all means just follow these two examples:
Sketch does a good job of copying and renaming layers while you’re working fast. For the most part, the names of layers don’t matter when you’re working purely visually. However, when you start animating and all your layers are named some version of Oval then it gets hard to know what you’re trying to edit.
Don’t leave your layers like this:
Rename your layers to something understandable, unique and descriptive. Don’t use spaces, and only use alpha numeric characters (none of these: !@#$%^&*()) BECAUSE if you do want to export to code these kinds of chars just don’t mix well with compilers.
Rename your layers to this:
The face animation looks like it’s all dark and fills in with another color… At first, this may appear to be a tricky animation – you might think you need masks and odd shapes, or some kind of fancy scaling – but it really isn’t if you can think about how to break down your animation into simple components.
The easiest way to “fill in the face” is two use copies – one dark, overlaid with one light. Let’s set that up…
leftEye, rightEye and smile layers.darkFacelightFaceYour design file should look like this:
Done. We’re ready to Flow.
We’re going to modify the shape in Flow so that it only shows half of the shape’s border, making it a smile.
Also, we can animate the path of the circle in Flow. This is why we use a path instead of a solid shape.
Another way to keep things simple is to know how you can manipulate shapes / layers in Flow.
This is also why the checkMark is a path and not a solid shape either.
Now, our design is all set to be animated. Let’s get to it.
Head on over to Flow where we’ll finish setting things up, and get started with our animation.
First, let’s get things ready.
4.0sYou can change the timeline duration by tapping the small clock icon above the right-hand side of the timeline.
We’ll start with the background because it’s most visual part of the animation.
backgroundShape0.25s60#CF0263 (or r: 207, g: 2, b: 99 if you’re not on OSX 10.14)
1.0swidth to 70
2.0sfillColor to #0CCDA2 (or r: 12, g: 205, b: 162 if you’re not on OSX 10.14)1.0s
3.1swidth to 3002.6s
That’s it, the main background animation is in place. Check it out:
Let’s animate the dark face now.
darkFace layer⌘⌥R)90°end to 0.5
Using stroke
startandendare great for animations and iOS. But, if you’re exporting to HTML you’ll have to usedashPatternand the patternoffsetto get the same results.
Next, we’re going to add a subtle scale animation to the face. This requires a couple steps.
0.75soff relative modedarkFace group20 x 20stroke width to 40
0s
1.0s
2.0sfillColor for leftEye and rightEye to #28987FstrokeColor for smile to #28987F
1.0
opacity to 0step left
The
step leftanimation curve makes it so the change in value happens right at the last moment of the animation.
Now, let’s animate the filled in portion of the face.
Our next goal is to animate the filled in version of the face. Let’s start with that smile ;)
reveal the lightFace layer
turn on relative mode (⌘⌥R)
select the smile layer
rotate the shape to 90°
set the stroke end to 0.5
These were the same steps that we did to the dark version.
Now let’s animate the face. We’re going to scale and fade in the right eye, animate the smile, then scale and fade in the left eye.
1.0srightEye and change its size to 5 x 50t=0rightEye from the end of the timeline to 1.25s
1.25s, change the smile stroke start to 0.51.75s
1.75srightEye animationleftEye
2.25slightFace group02.0s
Let’s animate the checkmark now.
ON relative modeend to 0OFF relative mode2.60Change its stroke end to 1.0
2.35s3.35s3.1s
Last but not least, let’s do the title.
titleLabel3.1s00.5s0.75s0
0.75sd from the layer’s text fieldString track
That’s it! We’ve created a nice button animation, and learned a few things along the way like:
result(s) found for “”.