immutable-transform-matrix
v0.6.0
Published
A matrix library using ImmutableJS data structutes
Downloads
65
Readme
immutable-transform-matrix
A library for creating affine transform matrix (3x3) that extend an Immutable Map.
These matrices can be used for matrix calcuations on SVG CTMs (current transform matrix).
Inspired by transformation-matrix-js
API Documentation
Install
yarn add immutable-transform-matrix
Examples
import { Matrix } from 'immutable-transform-matrix'
import { isImmutable } from 'immutable'
const m1 = new Matrix()
const m2 = m1.translate(10, 20)
isImmutable(m1) // true
m1.get('e') // 0
m2.get('e') // 10
const transform = new Matrix()
.scale(2)
.toString()
const ViewPort = () => <g transform={transform} />