Design+Code logo

Quick links

Suggested search

To complete the home screen, we will create a tab bar. The tab bar is a fundamental UI element of any app. It allows users to navigate through your app. To make it even more compelling, we will animate the buttons using Lottie Animation.

lottie

Container

Let’s start by by creating the body of our tab bar.

  • Add a Stack H and set the Alignment to Top and the Distribution to Space Around
  • Keep the Width to 100% and set the Height to 88PT
  • Add a padding top of 4
  • Pin To Bottom Left and toggle the Pin To Page
  • For the BG Color, add a new Color Gradient #31395B - #21263D, opacity 70%
  • Set the Corner Radius of both top edges to 24
  • In Effects, add a BG Blur Dark
  • Add Drop Shadow: Outer, Offset X 0, Offset Y 10PT, Blur 20 and color black, opacity 30%

01

Tab Item

Next, we will design the tab button

  • Add a Stack V, set the Alignment to Center
  • Set the Width and the Height to 48PT

In the Tab Item, add an image element.

  • In Settings, set the image to location from the assets
  • Set the Width and the Height to 48PT and Pin To Center Center

02

Lottie

On top of the icon, we will add a Lottie element. In Settings, select the Lottie and go to LottieFiles. There’s you can use a sample one or you can upload your own. I will put the Lottie links in the description below.

Location: https://assets2.lottiefiles.com/packages/lf20_mJrV9KGTAm.json

  • Set the Loop to None and the Reset on Complete off
  • Set the Width and Height to 48PT. Pin To Center Center

03

In the preview, you can see that the icon and the animation aren’t the same size. In Appearance, I will scale to 120% and set the Offset Y to 1.

Then, make the Tab Item into a component and duplicate it 3 times. Let’s change the icons and the animations.

Trip: https://assets3.lottiefiles.com/packages/lf20_5oiT0rTiSq.json

Fav: https://assets10.lottiefiles.com/packages/lf20_dn2jci4YQz.json

Message: https://assets5.lottiefiles.com/packages/lf20_2awSejntX7.json

04

States

Now that it is a component, we have access to states. The goal is to tap on the button and hide the icon while playing the lottie animation. Go in the Tab item component screen, add a custom state and name it: Tapped.

In that state, select the icon and we will set the 3D Transform Rotation Y to 90 and set the opacity to 0. In Default and Tapped, disable Autoplay.

Interactions

For the interactions, we will first make the Tab bar into a component. Then, go to the component’s screen and select the first Lottie. Here in total, we will add 8 different actions. To make things easier to understand, let’s rename the Tab Item and Lottie by adding a number next to it.

05

First action is to play the lottie animation, add a tap trigger and select Lottie Controls, Target self, Playback is Play, Frame 0 - 150, Loop to None and disable Reset on Complete.

06

Then, add another Lottie Controls, but this time, set the Target to the second Lottie. Playback to Play, Frame 0 - 0, Loop to None and disable Reset on Complete. Repeat the same steps for the third and fourth Lottie.

07

For the fifth action, add a Set State, Target Tab Item, Start State to Current State and End State to Tapped. The Duration is 0.5s and Easing to Ease In & Out.

08

Then, add another Set State, but this time, set the Target to the second Tab Item. Start State to Current State and End State to Default. The Duration is 0.5s and Easing to Ease In & Out. Repeat the same steps for the third and fourth Tab Item.

09

10

Basically, this interaction plays the lottie and set the state to tapped while resetting the 3 others.

Copy actions

By tapping on the more icon, you can select Copy Actions and paste it on the 3 other Lotties. Using the same logic, apply the right Lottie Controls and Set State.

11

Preview

In the preview, we want the first Lottie to play on load so toggle the Autoplay of the first Lottie. Also, set the Tab Item to Tapped.

12

BACK TO

Custom Segmented Controls

READ NEXT

Sidebar menu animation

Templates and source code

Download source files

Download the videos and assets to refer and learn offline without interuption.

check

Design template

check

Source code for all sections

check

Video files, ePub and subtitles

Assets

Videos

Subtitles

Meet the instructor

We all try to be consistent with our way of teaching step-by-step, providing source files and prioritizing design in our courses.

Willie Yam

Front-end/UI developer at Design+Code

I do UI coding. HTML/CSS/JS/SWIFTUI dev.

icon

10 courses - 37 hours

course logo

Design and Prototype an App with Play

Build a completely functional prototype without writing a single line of code from your phone

3 hrs

course logo

Create a 3D site with game controls in Spline

Build an interactive 3D scene implemented on a ReactJS site using Figma and Spline

2 hrs

course logo

Build a Movie Booking App in SwiftUI

Learn how to create an iOS app based on a beautiful UI design from Figma with interesting animations and interactions, create a custom tab bar and use navigation views to build a whole flow

1 hrs

course logo

Build Quick Apps with SwiftUI

Apply your Swift and SwiftUI knowledge by building real, quick and various applications from scratch

11 hrs

course logo

CSS Handbook

A comprehensive series of tutorials that encompass styled-components, CSS, and all layout and UI developments

1 hrs

course logo

Advanced React Hooks

Learn how to build a website with Typescript, Hooks, Contentful and Gatsby Cloud

5 hrs

course logo

Unity for Designers

If you want to make a game and don't know where to start, you are in the right place. I will teach you how to use Unity, code in C# and share essential tips and tricks to make your first game.

5 hrs

course logo

Create a Javascript Game

Learn how to create a web game using Phaser 3, a popular javascript game engine. Draw a map using an editor, implement the player, make the player move, apply physics, collisions, and implement the enemies.

2 hrs

course logo

Build an ARKit 2 App

Introduction to ARKit and learn how to make your own playground. You will be able to add models or even your own designs into the app and play with them

4 hrs

course logo

Create a SpriteKit Game

Overview of SpriteKit a powerful 2D sprite-based framework for games development from Apple and learn how to create your very own platform

3 hrs