パッケージ、リポジトリ、アプリカテゴリを検索

path_morph のカバー
パッケージ詳細v1.1.1

path_morph

このパッケージを使用すると、パスのTweenアニメーションを作成できます。言い換えれば、1つのパスを別のパスに変形できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
98
いいね数
61
Pub ポイント
150

パッケージをインストール

flutter pub add path_morph

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

path_morph は、滑らかなパスの補間アニメーションを可能にするFlutterパッケージで、開発者がカスタムパスを別のパスに変形できるようにします。アニメーションにおける形状やアウトライン間のスムーズな視覚的遷移を作成するのに最適です。このパッケージはすべての主要プラットフォームをサポートしており、Flutterのアニメーションシステムとシームレスに統合されます。2つのパスのポイントを時間とともに補間することで動作し、アイコン、ローダー、またはダイナミックなイラストなどのUI要素に対して視覚的に魅力的な結果を生み出します。

用途

  • アニメーションアイコンのトランジションを作成する
  • UIにおける流体形状の変形デザイン
  • カスタムパスベースのグラフィックのアニメーション化
  • インタラクティブな読み込みインジケーターの構築
  • アプリにおけるビジュアルストーリーテリングの向上

主な機能

  • スムーズなパス補間
  • クロスプラットフォーム対応
  • パスアニメーション用のシンプルな API
  • Flutter の AnimationController との統合
  • 複雑なパスジオメトリをサポートします

適している対象

  • ダイナミックなビジュアルを求めるUI/UXデザイナー
  • アニメーションイラストを構築する開発者
  • カスタムパス遷移を必要とするアプリ
  • 滑らかな動きを備えたインタラクティブプロトタイプ

注意事項

  • 非常に複雑なパスではパフォーマンスが異なる場合があります
  • スムーズな結果を得るためには、パスの構造に注意が必要です
  • 軽量なアニメーションに最適
  • リアルタイムでのユーザー描画パスには適していません
  • 外部入力なしの静的パスモーフに限定

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Path Morph

This is a pure Dart package that lets you smoothly morph one Flutter Path object into another. You can think of this as a path tween animation. The idea is to take two paths, a source path and a destination path, and smoothly move the points of the source path until it looks exactly like the destination path.

Usage

First you need to sample two paths using the PathMorph.samplePaths() method, which returns a SampledPathData object.

SampledPathData data = PathMorph.samplePaths(path1, path2);

Then you call the PathMorph.generateAnimations() method to create an animation for every point in the path. This method needs an AnimationController object and a SampledPathData object as arguments. Additionally, it expects you to pass a function to it, one that takes two arguments itself. In the body of the function, you must call setState() and update the value of the shiftedPoints list, which is present in the SampledPathData object.

AnimationController controller = AnimationController(vsync: this,
                                    duration: Duration(seconds: 1));

PathMorph.generateAnimations(controller, data, (i,z) {
    setState((){
      data.shiftedPoints[i] = z;
    });
});

Lastly, while rendering the morph animation, you can call the PathMorph.generatePath() method and pass the shiftedPoints list to it. This returns a Path object you can draw on your canvas. If you are using a CustomPainter object, you'll want to pass the path as an argument to it.

@override
Widget build(BuildContext context) {
    return CustomPaint(painter: MyPainter(PathMorph.generatePath(data)));
}

Do take a look at the example project to get a better idea.

Important

This package currently allows you to morph two paths only if they both have an equal number of contours. You can think of a contour as a line you can draw without lifting the pen. For example, the path to draw a triangle, a circle, or a square has one contour only. But a path to draw two concentric circles will have two contours.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。