Convert text to paths and animate them with this Flutter package

Overview

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 file it on this project's GitHub repository.

You might also like...

Change Application's name, package name, icon and Splash in one shot by one Command on Android & IOS

Change Application's name, package name, icon and Splash in one shot by one Command on Android & IOS

Change Application's name, package name, icon and Splash in one shot by one Command on Android & IOS. Installing dart pub global activate before_publi

Oct 27, 2022

Flutter package for creating awesome animations.

Flutter package for creating awesome animations.

🎬 Simple Animations Simple Animations is a powerful package to create beautiful custom animations in no time. 💪 fully tested 📝 well documented 💼 e

Dec 31, 2022

A flutter package that adds support for vector data based animations.

animated_vector Description and inspiration A package that adds support for vector data based animations. The data format is heavily inspired from the

Apr 26, 2022

A flutter package which makes it easier to display the difference between two images.

A flutter package which makes it easier to display the difference between two images.

👏 Before After A flutter package which makes it easier to display the differences between two images.. The source code is 100% Dart, and everything r

Dec 30, 2022

A Flutter Package providing Avatar Glow Widget

A Flutter Package providing Avatar Glow Widget

Avatar Glow This Flutter package provides a Avatar Glow Widget with cool background glowing animation. Live Demo: https://apgapg.github.io/avatar_glow

Dec 22, 2022

A Flutter package with a selection of simple yet very customizable set of loading animations.

A Flutter package with a selection of simple yet very customizable set of loading animations.

Flutter Loading Animations A simple yet very customizable set of loading animations for Flutter projects. Installation Add the following to your pubsp

Sep 23, 2022

A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.

A beautiful animated flutter widget package library. The tab bar will attempt to use your current theme out of the box, however you may want to theme it.

Motion Tab Bar A beautiful animated widget for your Flutter apps Preview: | | Getting Started Add the plugin: dependencies: motion_tab_bar: ^0.1.5 B

Nov 15, 2022

☀️ A Flutter package for some material design app intro screens with some cool animations.

☀️ A Flutter package for some material design app intro screens with some cool animations.

IntroViews is inspired by Paper Onboarding and developed with love from scratch. Checkout our fully responsive live example app. Table of contents Fea

Dec 30, 2022

A light weight package for flutter apps, that easily shows a splash screen with a nice fade animation.

Animated Splash Screen Using the package Get the library environment: sdk: "=2.1.0 3.0.0" Add dependency in pubspec.yaml dependencies: animated_

Oct 6, 2022
Comments
  • Generate character path without thickness

    Generate character path without thickness

    Currently the package is drawing path with thickness even if we take the thinnest font possible it gives back a thick path. Feature should be added to just obtain a single lined character path.

    opened by muhammadidrees 0
  • https://fonts.google.com/?preview.text=kumarOneOutline+:&preview.text_type=custom&query=kumar+One+Outline

    https://fonts.google.com/?preview.text=kumarOneOutline+:&preview.text_type=custom&query=kumar+One+Outline

    Hi,

    Found this issue with the librairie.

    The error happend with ":" and the font : https://fonts.google.com/?preview.text=kumarOneOutline+:&preview.text_type=custom&query=kumar+One+Outline

    
    I/flutter (13628): EnumFontStyle.kumarOneOutline
    E/flutter (13628): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The method '[]' was called on null.
    E/flutter (13628): Receiver: null
    E/flutter (13628): Tried calling: []("points")
    E/flutter (13628): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:53:5)
    E/flutter (13628): #1      PMFont.generateSVGPathForCharacter 
    package:text_to_path_maker/src/pm_font.dart:91
    E/flutter (13628): #2      PMFont.generatePathForCharacter 
    package:text_to_path_maker/src/pm_font.dart:41
    E/flutter (13628): #3      _ClockAgentState.createNewPath 
    package:tv/…/agent_clock/agent_clock.dart:243
    E/flutter (13628): #4      _ClockAgentState.initClockVariable.<anonymous closure> 
    package:tv/…/agent_clock/agent_clock.dart:90
    E/flutter (13628): #5      _rootRunUnary  (dart:async/zone.dart:1134:38)
    E/flutter (13628): #6      _CustomZone.runUnary  (dart:async/zone.dart:1031:19)
    E/flutter (13628): #7      _FutureListener.handleValue  (dart:async/future_impl.dart:139:18)
    E/flutter (13628): #8      Future._propagateToListeners.handleValueCallback  (dart:async/future_impl.dart:680:45)
    E/flutter (13628): #9      Future._propagateToListeners  (dart:async/future_impl.dart:709:32)
    E/flutter (13628): #10     Future._completeWithValue  (dart:async/future_impl.dart:524:5)
    E/flutter (13628): #11     _AsyncAwaitCompleter.complete  (dart:async-patch/async_patch.dart:32:15)
    E/flutter (13628): #12     _completeOnAsyncReturn  (dart:async-patch/async_patch.dart:290:13)
    E/flutter (13628): #13     PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart)
    

    Regards

    opened by bounty1342 0
  •  Unhandled Exception: RangeError (byteOffset): Index out of range: index should be less than 1632: 1632

    Unhandled Exception: RangeError (byteOffset): Index out of range: index should be less than 1632: 1632

    issue

    Am getting this error once i include my own fonts in the assets folder and register them in .yaml file and run the example project.

    What could be possibly going wrong ??

    opened by Arthur-Kamau 3
Owner
Ashraff Hathibelagal
Develops Android and iOS apps using Flutter
Ashraff Hathibelagal
🔔 A flutter package to create cool and beautiful text animations. [Flutter Favorite Package]

Animated Text Kit A flutter package which contains a collection of some cool and awesome text animations. Recommended package for text animations in C

Ayush Agarwal 1.4k Jan 6, 2023
Flutter package for Skeleton Text Animation

skeleton_text A package provides an easy way to add skeleton text loading animation in Flutter project Dependency dependencies: skeleton_text: How

101Loop 35 Aug 15, 2022
Flutter widget that automatically resizes text to fit perfectly within its bounds.

ONLY FOR FLUTTER WEB Flutter widget that automatically resizes text to fit perfectly within its bounds. Show some ❤️ and star the repo to support the

Rebar Ahmad 4 Jan 6, 2022
Dart package that converts number to words (English language)A Flutter/Dart package that converts number to words (English language)

flutter_number_to_words_english A Flutter/Dart package that converts number to words (English language) Flutter (Null Safety) Flutter (Channel stable,

Ke Nguyen 4 Dec 9, 2022
A flutter package which contains a collection of some cool and beautiful effects; support android and ios

flutter effects A flutter package which contains a collection of some cool and beautiful effects; support android and ios . Screenshot type support ch

大海豚 462 Jan 3, 2023
A package to create nice and smooth animations for flutter

animation_director A package to create nice and smooth animations for flutter Introduction A simple package to build beautiful and smooth animations f

null 10 Nov 28, 2022
A Flutter package for a quick and handy giffy dialog.

?? Giffy Dialogs A beautiful and custom alert dialog for flutter highly inspired from FancyAlertDialog-Android. The source code is 100% Dart, and ever

Sahil Kumar 626 Dec 29, 2022
A flutter package which will help you to generate pin code fields with beautiful design and animations

A flutter package which will help you to generate pin code fields with beautiful design and animations. Can be useful for OTP or pin code inputs ?? ??

Adar 550 Dec 23, 2022
A Flutter package to custom splash screen like change logo icon, logo animation, and splash screen background color.

Custom Splash Screen A Flutter package to custom splash screen: change logo icon, logo animation, and splash screen background color. (Custom from ani

tranhuycong 78 Sep 6, 2022
This package helps you daily usable function and ready-made Widgets with ease.

Show some love and like to support the project Documentation API Docs are available. Platform Support Android iOS MacOS Web Linux Windows ✔️ ✔️ ✔️ ✔️

Bhoomin Naik 51 Dec 23, 2022