In this proposal, I’ve tried to create an APP with a simple UI, but at the same time adding some meaningful animations when the user first interacted with the APP. To demonstrate how they would follow, I started to use Framer.
Framer has a Documentation that answer all our doubts about the tool. But if you get stuck in one point and can’t manage to go any further, don’t panic.
They have a awesome Group on Facebook where people help each other and post great stuff every day.
Starting to use Framer
The first thing I did was finding a way to get the information from the API and show in the prototype. Framer made my life much easier because with one line of code, I get a JSON with all the data needed.
Then, I started to project on how I’d build the interface elements with framer. Some time reading the documentation and that’s what I figured out:
- First, I had to create a container to insert all the items for the listed coins;
- Then, I needed to create a item that would show the most important informations of the coins (name and price);
- If the users wanted to know more about one coin, they’d have to tap on the open modal to view more specific information.
With all that in mind, I started the code.
Even if you’re not a programmer, no need to be so scared of the code tab, because when you draw a rectangle in your Sketch or Framer design tab, it’s the same thing as telling your computer: “hey, draw this line of code, and draw it with this color and in that position…”
Something like this:
I know life’s not so simple. Layouts are complex and learning how to code is a real challenge, but that stupid example shows how you can start thinking and begin to create some elements in the code tab.
With this in mind, let’s go back to the app.
Before, I’ve said that first we needed to create a container list where we’d put all the coins and show the main info. Taking all this consideration, I found on the Framer docs the ScrollComponent, and made this:
After the ScrollComponent is made, we have to create a component with three elements:
- A Background Layer;
- A TextLayer that shows the name of the coin;
- Another TextLayer aligned in the right wich shows the current price of the coin.
Taking this infos into account, let’s create this component that I’ve named as coinRow:
Now is with more lines of code, but if you take some time and read the elements, you’ll see the example above is very similar to the one you’ve made in Sketch:
In this items, I used a Layer, and two TextLayers. Bellow each item I put its properties, like backgroundColor, fontSize and more.
Now, here comes a cool part. Let put some real data using Javascript Loops.
You can think of a loop as a computerized version of the game where you tell someone to take X steps in one direction then Y steps in another; for example, the idea “Go five steps to the east” could be expressed this way as a loop
If you’d like to know more about JS Loops, I recommend this.
Back to the code, We get this:
And this is the result that generated from all the code We’ve made before:
Cool, isnt it?
In this post I wont demonstrate how I’ve build the overlay page, just for it was pretty similar to the examples above. I only created Layers and TextLayers.
Now, I’ll show how we can animate elements with Framer.
Working with animations on Framer
There are two ways we can animate using Framer: Using Animation Objects or switching between States. I’ll talk about each one and show how I personally used it.
In my prototype, I have 4 main animations:
- When the user taps in a coinRow, the others coins hide themselves;
- The selected coinRow keeps the background but the infos are hidden;
- We increase the height of the coinRow and give the same size of the modalCover, changing the y position to the current position of the scroll;
- Then, we go to the modal page.
With that in mind, we can begin to write our animations.
Animation Objects
Animation objects manage targeted animations on a layer. It’s options allow you to define curves, timing, delays and more
States
Layer states manage and organize different combinations of layer properties. For example, you can see:
With our states and animations created, we now have to mix that with some events to get this result:
Once the animation is working nicely, we have to show the modal for our users. To make this happens, we need to use the FlowComponent.
Flow Components
The FlowComponent helps your transition and navigation throught prototype screens. Using this is quite simple, take a look:
With flow content, you can simulate common transitions like flow.showNext(page) and flow.showPrevious(), or create a custom animation, that was the case with my experiment.
To make this, you have to:
And that’s all folks. For this post I simplified the code to the fullest so I could give you a glimpse on how powerful Framer really is. My final prototype is more complete, I ended adding some colors, coin icons and charts (unfortunately the charts are just a .svg file, the CoinMarketCap API doesn’t provide historical data — yet).
See the prototype live:
If You’re not familiar with Javascript and want to learn more about Coffeescript in Framer, I strongly recommend the Javascript30. Wes Bos gives awesome tips and help us with that with his 30 days challenge.
If you want to create an experiment with real data but don’t know wich API to use, this repository contains a long list that you can check.
Also, if you’re from Rio de Janeiro, I’ll start to organize Meetups about Framer. Interesteds in learning more, or talking about it, please join us in our Facebook Group.
The full post example code here:
Thanks for reading. 😊