# ftfiles

> Fourier Transform Files are files that aim to encode simple vector image data

Latest version **1.2.4** (published 2021-09-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install ftfiles
pnpm add ftfiles
yarn add ftfiles
bun add ftfiles
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2021-09-18 |
| First published | 2021-05-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Maxim Tyuterev |
| Maintainers | maxty99 |

## Links

- npm: https://www.npmjs.com/package/ftfiles
- Repository: https://github.com/Maxty99/FTFiles
- Homepage: https://github.com/Maxty99/FTFiles#readme
- Issues: https://github.com/Maxty99/FTFiles/issues
- npm.io page: https://npm.io/package/ftfiles

## Dependencies (1)

- [ts-complex-numbers](https://npm.io/package/ts-complex-numbers.md) ^1.0.5

## Recent versions

- 1.2.4 (latest) — 2021-09-18
- 1.2.3 — 2021-09-18
- 1.2.2 — 2021-09-18
- 1.2.1 — 2021-09-18
- 1.2.0 — 2021-09-18
- 1.2.2-beta — 2021-09-18
- 1.2.1-beta — 2021-09-18
- 1.2.0-beta — 2021-09-18
- 1.1.18 — 2021-09-18
- 1.1.17 — 2021-09-18
- 1.1.16 — 2021-09-18
- 1.1.15 — 2021-09-18
- 1.1.14 — 2021-09-18
- 1.1.13 — 2021-09-18
- 1.1.12 — 2021-09-18
- … 30 more at https://npm.io/package/ftfiles/versions

## README

# FTFiles

![Npm Downloads](https://img.shields.io/npm/dm/ftfiles)

---

Fourier Transform Files are files that aim to encode simple vector image data. The goal of this library is to provide a way to take a svg file with a **single** svg path. Then it will calculate and re-encode it into a set of coefficients that apply to a complex fourier series.

# Usage

This can be done client side the following way:

```ts
import { FTProcessor } from 'ftfiles';

// Create a SVGProcessor instance
const ftProc = new FTProcessor(path); // Path must be an SVGPathElement

ftProc.processPoints(numberOfPoints); // Doing discrete integration basically, you have to do this before transforming
ftProc.dft(); // Does the transformation

ftProc.getCoefficients(); // used to retreive the coefficients of the series
```

Then the coefficients can be read in order to draw it with the drawing module

```ts
import { FTDrawer } from 'ftfiles';

// Say we already have coefficents (be it serialized and sent from backend, calculated client side)
const coefficients = ftProc.getCoefficients();

const drawer = new FTDrawer(coefficients);
drawer.setCanvas(canvas); // Set the canvas to which to draw (Param must be Canvas element)
drawer.setScale(1); // Set the scale at which to draw
drawer.draw(); // Draws
```

Heres a sample repo using this library: https://github.com/Maxty99/FTFileWeb

# Thanks

- **Biocinematics**([![Twitter URL](https://img.shields.io/twitter/follow/Biocinematics?style=social)](https://twitter.com/Biocinematics)): Fourier one-line SVG used for testing and examples: https://twitter.com/Biocinematics/status/1143330623131738112
- **3Blue1Brown**([![Twitter URL](https://img.shields.io/twitter/follow/3blue1brown?style=social)](https://twitter.com/3blue1brown)): For the inspiration to make this
- **Node**([![Node Website](https://img.shields.io/github/stars/nodejs?style=social)](https://github.com/nodejs)): Framework used
- **netsec917**([![Npm Package](https://img.shields.io/npm/dm/ts-complex-numbers)](https://www.npmjs.com/package/ts-complex-numbers)): For the complex number library

---
_Source: https://npm.io/package/ftfiles · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
