0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

React nativeとExpoの構成でLottieアニメーションの組み込み法を解説

Last updated at Posted at 2025-02-07

Lottieとは

Lottieは、Adobe After Effectsで作成されたアニメーションをiOS、Android、web、React Native、Reactなどのアプリで再生できるようにするライブラリです。Bodymovinと呼ばれるAfter Effectsのプラグインを用いてアニメーションをJSON形式でエクスポートし、そのJSONファイルをLottieが読み込むことでアプリ内にて再生できます。

LottieはAirbnbが開発し、コミュニティに公開しています。スケーラブルで動的なアニメーションを簡単に実装できるため、UI/UXの向上に役立つツールとして多くの開発者に利用されています。

アニメーションを探す

まず初めに自分が使用したいlottieアニメーションをLottiefileで探します 無料 有償どちらのアニメーションもあります。

ライブラリをインストールする

Expo React native Lottie用の公式ページ 利用方法などはここを参照

Expo用のLottie Reactライブラリをインストール

npx expo install lottie-react-native

Lottie React Native ライブラリリポジトリ READMEを参照

ディレクトリ構成

/ ━ app ━ index.jsx
  ┣ assets ━ bay.json(好きなアニメーションに適宜入れ替え)

コード

import React from "react";
import LottieView from "lottie-react-native";

export default function Animation() {
    return (
        <LottieView
            source={require("../assets/bay.json")}
            style={{width: "100%", height: "100%"}}
            autoPlay
            loop
        />
    );
}

Lottie公式ドキュメント

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?