Animation in mobile development: what it is, types and how to use

Author: IT Sectr Published: 2026-02-26 Reading time: 10 min

Animation in mobile apps makes them lively and responsive, guiding the user's attention and improving interface perception. In this article we will cover the main types of animations in iOS and Android: Property Animation, View Animation, UIKit Dynamics, Core Animation, Lottie, Rive, Spring Animation, Hero Animation and Shared Element Transition. The material will help beginner developers understand which tools and libraries to choose for a specific task. For more details — see the official Android Animations documentation.

Key Takeaways

  • Property Animation (Android) changes real object properties, View Animation — only visual representation
  • Core Animation and UIView.animate (iOS) provide built-in capabilities for animating layers and views
  • Lottie and Rive allow embedding complex vector animation from After Effects and Rive Editor
  • Hero Animation (Shared Element Transition) creates smooth transitions between screens
  • Spring Animation with spring physics and Easing (Interpolator) make animation natural

Animation in Android: Property Animation and View Animation

Android provides two main animation systems: View Animation (legacy) and Property Animation (modern). View Animation (or Tween Animation) works only with visual representation — it changes the display of the View but not its actual properties (for example, click coordinates remain in place). Property Animation, introduced in Android 3.0, changes real object properties through Animator — ValueAnimator, ObjectAnimator or AnimatorSet.

ObjectAnimator and ValueAnimator

ObjectAnimator is the most popular Property Animation class. It animates a specific object property (for example, translationX, alpha, scaleY) over a specified time with a given Interpolator.

kotlin
ObjectAnimator.ofFloat(myView, "translationX", 0f, 300f).apply {
    duration = 500
    interpolator = FastOutSlowInInterpolator()
    startDelay = 200
}.start()

ValueAnimator is not tied to a specific object — it generates values that can be used for any property or custom logic.

View Animation and XML Animations

View Animation is described in XML files res/anim/. Four types are supported: scale, translate, rotate, alpha. The drawback is that animation does not change real View parameters. For simple effects (blinking, rotation) View Animation is still applicable, but for new projects Property Animation is recommended.

Animation in Jetpack Compose

Jetpack Compose offers a modern animation API: animateAsState, Animatable, AnimatedVisibility and AnimatedContent. Animation in Compose is reactive: when the state changes, animation starts automatically.

kotlin
var expanded = remember { mutableStateOf(false) }
val size = animateAsState(
    if (expanded) 200f else 50f
)
Box(
    modifier = Modifier
        .size(size.value, size.value)
        .clickable { expanded = !expanded }
        .background(Color.Blue)
)

Animation in iOS: Core Animation and UIView.animate

iOS provides a powerful animation stack based on Core Animation — a low-level framework working with CALayer. UIKit builds on top of Core Animation with convenient UIView.animate and UIViewPropertyAnimator methods.

UIView.animate

UIView.animate is the simplest way to animate in iOS. It allows animating frame, alpha, transform, backgroundColor and other UIView properties.

swift
UIView.animate(
    withDuration: 0.5,
    delay: 0.2,
    usingSpringWithDamping: 0.6,
    initialSpringVelocity: 1.0,
    options: [.curveEaseInOut]
) {
    myView.frame.origin.x += 300
    myView.alpha = 0.5
}

UIKit Dynamics

UIKit Dynamics — a framework for physical animation: gravity, collisions, springs, attachment forces. It allows creating realistic object behavior without manual physics calculation. Used for custom transitions, animated menus and game elements.

CAAnimation and Core Animation

Core Animation (CAAnimation, CABasicAnimation, CAKeyframeAnimation) — a low-level API for CALayer animation. Supports 3D transformations, path animation (keyframe), masking and composition. SwiftUI uses Core Animation under the hood through animation and withAnimation modifiers.

swift
let animation = CABasicAnimation(keyPath: "transform.rotation.z")
animation.fromValue = 0
animation.toValue = CGFloat.pi * 2
animation.duration = 1.0
animation.repeatCount = .infinity
myLayer.add(animation, forKey: "rotation")

For the majority of iOS projects SwiftUI with its built-in animation is used. For example, withAnimation wraps state changes in an animated context.

Vector Animation: Lottie and Rive

Complex animations (characters, transitions, loaders) are difficult to implement with code. Lottie and Rive solve this problem by allowing designers to create animation in visual editors and developers to embed it into the app as a ready-made component.

Lottie

Lottie — a library from Airbnb (now LottieFiles) that renders animations from Adobe After Effects exported in JSON format. Supported on Android, iOS, Flutter, React Native and Web. Lottie animations are vector, scale without quality loss and can be customized programmatically (speed, progress, colors).

kotlin
// Android
import com.airbnb.lottie.LottieAnimationView
val lottieView = findViewById<LottieAnimationView>(R.id.lottieView)
lottieView.setAnimation(R.raw.loading_animation)
lottieView.playAnimation()

Rive

Rive (formerly 2Dimensions) — a more advanced tool for vector animation. Unlike Lottie, Rive supports interactive animation: states, triggers, transitions. Animation is created in Rive Editor and controlled in the app through State Machine. Rive is suitable for game interfaces, animated icons and complex transitions with feedback.

At IT Sectr we use Lottie for decorative animations (loaders, successful operations, empty states) and Rive for interactive elements of onboarding screens. This reduces animation development time by 60% compared to manual implementation with UIKit or Canvas.

Shared Element Transition and Hero Animation

Shared Element Transition — animation where an element (image, text, card) smoothly moves and transforms when transitioning between screens. This creates the illusion of continuity: the user does not "go" to a new screen, but "falls into" the element.

Android Shared Element Transition

In Android the transition is implemented through ActivityOptionsCompat and transitionName attributes. FragmentTransaction supports addSharedElement for transitions within an Activity. Compose uses SharedTransitionLayout with SharedContentState.

iOS Hero Transition

iOS does not have a built-in Hero Transition, but the Hero library (by Luke Zhao) implements this pattern on UIKit. Simply assign an id to elements on both screens — Hero will automatically create a smooth transition. In SwiftUI, transition animation is built in through NavigationStack and matchedGeometryEffect.

Flutter Hero

Flutter has a built-in Hero widget with a tag parameter. When two pages contain Hero with the same tag, Flutter automatically animates the transition between them. This is one of the simplest ways to implement complex animation in a mobile application.

dart
Hero(
    tag: 'profile_avatar',
    child: CircleAvatar(
        backgroundImage: AssetImage('avatar.jpg'),
        radius: 50,
    ),
)

Spring Animation, Interpolator and Easing

To make animation look natural, speed curves are used — Interpolator in Android and Easing in iOS. They determine how animation speed changes from start to end.

Android Interpolators

Android supports several built-in Interpolators: LinearInterpolator (uniform), AccelerateDecelerateInterpolator (slow-fast-slow), FastOutSlowInInterpolator (Material Design), OvershootInterpolator (with overshoot) and BounceInterpolator (with bounce). A custom Interpolator can be created through XML or the TimeInterpolator class.

Interpolator Behavior Usage
LinearInterpolatorConstant speedLoading indicators, infinite rotations
FastOutSlowInInterpolatorFast start, smooth finishMaterial Design, card appearance
OvershootInterpolatorOvershoots target and returnsAccent elements, buttons
BounceInterpolatorBounce at the endLists, pull-to-refresh

Spring Animation

Spring Animation models spring physics with damping and stiffness parameters. Damping 0 — infinite oscillations, 1 — no oscillations. Stiffness determines return speed. Spring Animation is available in iOS (UIViewPropertyAnimator with UISpringTimingParameters), Android (SpringAnimation from physics2) and SwiftUI (spring()).

The Spring Animation in Android documentation contains detailed configuration examples.

Timeline Animation

Timeline — an approach where animation is split into frames over time. Used for complex sequences where AnimationSet or Group animation are not flexible enough. Android supports AnimatorSet, iOS — CAAnimationGroup, Flutter — Interval in AnimationController.

Часто задаваемые вопросы

How is Property Animation different from View Animation?

View Animation (Android) changes only the visual display of a View without changing real properties (click position does not change). Property Animation changes actual object properties, providing more flexible and predictable behavior. For new projects always use Property Animation.

What is Hero Animation?

Hero Animation is an animation where an element smoothly moves and transforms when transitioning between screens, creating the illusion of continuity. Implemented through Hero (Flutter), SharedElementTransition (Android) or matchedGeometryEffect (SwiftUI).

Why are Lottie and Rive needed?

Lottie and Rive are libraries for rendering vector animation at runtime. A designer creates animation in After Effects (Lottie) or Rive Editor, exports to JSON, and the developer embeds it without writing animation code manually.

What is Spring Animation and why is it useful?

Spring Animation models spring physics: animation has natural damping and "bounce". SwiftUI and Jetpack Compose support spring animations out of the box, making the interface more lively and responsive.

How to choose the right Interpolator?

The choice depends on context: FastOutSlowIn — for element appearance, Overshoot — for accents, Linear — for loading indicators, Bounce — for lists. Material Design recommends standard curves: standard easing, deceleration easing and acceleration easing.

Summary

  • Property Animation (Android ObjectAnimator) — modern standard replacing View Animation
  • iOS uses UIView.animate and Core Animation for layer-level animation control
  • Lottie and Rive simplify embedding complex vector animation from design tools
  • Hero Animation (Shared Element Transition) improves navigation perception between screens
  • Spring Animation and proper choice of Interpolator / Easing make animation natural
  • Flutter provides a built-in Hero widget for transitions and AnimationController for custom animation
  • Jetpack Compose and SwiftUI have built-in reactive animation through animateAsState and withAnimation

We will develop a mobile application turnkey

IT Sectr creates iOS and Android applications for startups and businesses since 2017. We will advise you and propose the best solution.

Discuss the project