搜尋套件、儲存庫與 APP 分類

text_to_path_maker 封面
套件詳情v0.6.0

text_to_path_maker

一個 Flutter 套件,可將任何字型的字元轉換為路徑並進行動畫處理。

AndroidiOSmacOSWindowsLinux
近 30 天下載
1150
喜歡數
45
Pub 分數
150

安裝套件

flutter pub add text_to_path_maker

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個 Flutter 套件,可將任何字型的文字字元轉換為向量路徑,進而實現對其形狀與動畫的精確控制。它讓開發者能透過操縱單一路徑段來創造自訂的動畫文字效果。非常適合用於跨多個平台應用程式中的創意介面、動態字體與視覺敘事。此套件利用 Flutter 的渲染能力,提供流暢的動畫與高品質輸出。

適用情境

  • 動畫文字效果
  • 自訂排版設計
  • 互動式 UI 元素
  • 應用中的視覺敘事
  • 動態商標動畫

主要特色

  • 將字型字元轉換為路徑
  • 支援自定字型載入
  • 啟用基於路徑的動畫
  • 跨平台相容性
  • 高解析度輸出

適合對象

  • 尋求進階文字控制的設計人員
  • 開發動畫介面的開發者
  • 需要獨特排版視覺效果的應用程式
  • 創意多媒體應用
  • 具有藝術化UI需求的Flutter專案

使用建議

  • 複雜文字的記憶體使用量更高
  • 需要仔細的性能優化
  • 對非拉丁字母文字的支援有限
  • 動畫複雜度可能會影響幀率
  • 必須檢查字型授權以確認是否允許內嵌

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Text to Path Maker

This is a pure Flutter and Dart package that allows you to convert text--both characters and icons--into paths. It can generate SVG path strings and Flutter Path objects too.

Additionally, this package offers a bunch of methods you can use to animate those paths.

At the core of this package is a .ttf file parser, written in pure Dart. You can, if you want to, use it to read the font tables present in your TrueType font file.

Getting started

You must always start by calling the parseTTFAsset() method available in the PMFontReader class to parse your font asset. Currently, only .ttf files are supported.

Once the font has been parsed, you'll have access to a PMFont object. You can call its generatePathForCharacter() method to convert any character into a Path object. Note that this method expects you to pass the character code of the character.

Next, you'll want to use the PMTransform.moveAndScale() method to position and scale the path. This is usually necessary because, by default, the paths can be quite large.

At this point, you can render the Path object onto any Canvas object. If you want to animate the path, however, you must call the PMPieces.breakIntoPieces() method. This method splits the path into tiny paths, depending on the precision you specify. These tiny paths, when rendered sequentially, will create the illusion of the character being drawn.

There's also a utility PMPainter class, which extends the CustomPainter class. You can use this to quickly render your animation using a CustomPaint widget.

Refer to the example code to learn more.

Notes

This package is still a work in progress. It works reasonably well with most fonts, but there's no guarantee that it will handle every single font you have. It has been tested with Roboto, FontAwesome, and Material Icons. If you find a bug, you can raise an issue on this project's GitHub repository.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。