Code Monkey home page Code Monkey logo

flro's Introduction

🌐 english | český | русский

FLRO

FLR Optimizer is a AWK-based script for optimizing JSON formatted FLR files (exported from Rive). This experimental script was greatly influenced by the SVGO project. Please don't take it too seriously. ☺️

Screenshot

Why?

FLR files, especially those exported in JSON format, usually contain a lot of useless information. Such as non-optimal, too long values and so on, that can be safely converted without affecting the FLR rendering result much.

Where?

AWK is a domain-specific language designed for text processing and typically used as a data extraction and reporting tool. It is a standard feature of most Unix-like operating systems, such as macOS and Linux distributions.

Note about Windows: AWK is not available in Windows by default. Please use either gawk (you will need to change the command syntax a little) or in Windows 10 (from build 14328 and later), simply run a command from Linux Bash Shell (i have personally tested it there too).

Usage

In terminal navigate to folder with your FLR file and run following command:

awk '{
    while (match($0, /[0-9]+\.[0-9]+/)) {
        printf "%s%.2f", substr($0, 1, RSTART-1), substr($0, RSTART, RLENGTH)
        $0 = substr($0, RSTART+RLENGTH)
    }
    print
}' original.flr > optimized.flr

Parameters:

  • 2f is the number of digits after the decimal point (I do not recommend reducing it below 2).
  • original.flr is the name of your FLR file.
  • optimized.flr is the name of optimized FLR file.

Showcase in Flutter

The FLR file from the assets folder, in this repository, was optimized by this script. To test results of this script — please run following commands in terminal:

flutter upgrade
git clone https://github.com/tsinis/flro.git
cd flro
flutter create .
flutter run

License and Copyright

This project is released under the terms of the MIT license.

flro's People

Contributors

tsinis avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.