Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Animating SwiftUI Applications

You're reading from   Animating SwiftUI Applications Create visually stunning and engaging animations for iOS with SwiftUI

Arrow left icon
Product type Paperback
Published in Mar 2023
Publisher Packt
ISBN-13 9781803232669
Length 478 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Stephen DeStefano  Stephen DeStefano 
Author Profile Icon Stephen DeStefano 
Stephen DeStefano 
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Chapter 1: Exploring the Fundamentals of SwiftUI 2. Chapter 2: Understanding Animation with SwiftUI FREE CHAPTER 3. Chapter 3: Creating a Breathing App 4. Chapter 4: Building a Record Player 5. Chapter 5: Animating Colorful Kaleidoscope Effects 6. Chapter 6: Animating a Girl on a Swing 7. Chapter 7: Building a Series of Belts and Gears 8. Chapter 8: Animating a Bouquet of Flowers 9. Chapter 9: Animating Strokes around Shapes 10. Chapter 10: Creating an Ocean Scene 11. Chapter 11: Animating an Elevator 12. Chapter 12: Creating a Word Game (Part 1) 13. Chapter 13: Creating a Word Game (Part 2) 14. Chapter 14: Creating a Color Game 15. Chapter 15: Integrating SpriteKit into Your SwiftUI Projects 16. Index 17. Other Books You May Enjoy

Understanding timing curves

Animations have what are called curves. A curve, or more specifically, a timing curve, refers to the speed at which the animation starts and how it should end.

SwiftUI provides several timing curves to choose from that we can use inside the animation modifier. It’s called a timing curve because if you were to plot each point of the animation’s movement from start to finish on a graph, and draw a line by connecting those points, most of them would create a curved line, as in this illustration:

Figure 2.1: The ease timing curves

Figure 2.1: The ease timing curves

This graph shows three animation timing curves: easeIn, easeOut, and easeInOut. The beginning of the animation is at the bottom left, and the end is at the top right. In the easeInOut timing curve, the animation starts slow, speeds up, and then finally slows down before coming to a complete stop.

There is also a linear timing curve. An animation using this curve will have the same rate of speed at its beginning as it does at its end. If you were to plot it on a graph, it would be a straight line, like so:

Figure 2.2: The linear timing curve

Figure 2.2: The linear timing curve

Timing curves are not complicated – we get to choose the ones we want based on how we want the animation to look and perform. If you don’t specify a timing curve, you will get the default curve, the easeInOut one. We will use some of these SwiftUI-provided timing curves in our projects.

In the next section, I want to explain the two distinct types of animation in SWiftUI: implicit and explicit.

You have been reading a chapter from
Animating SwiftUI Applications
Published in: Mar 2023
Publisher: Packt
ISBN-13: 9781803232669
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image