css-quad

0.1.1 • Public • Published

Css Quad

Projective transformation of a plane (dom element).

Can be usefull to quickly add perspective to a dom element, or simply to animate a quad for transition purpose.

Based on this original post.
Another nice article can be found here.

Installation

npm i css-quad --save

Usage

import CssQuad from 'css-quad';
 
const cssQuad = new CssQuad(domElement);

Run npm i && npm start to build the demo.

Documentation

Constructor

CssQuad(domElement)

Public methods

resize()

This method has to be called whenever the dom element size changes.

update()

This method has to be called on RAF.

Getters & setters

p1 = {x,y}

p2 = {x,y}

p3 = {x,y}

p4 = {x,y}

Position of the quad anchors relative to the viewport.

Package Sidebar

Install

npm i css-quad

Weekly Downloads

3

Version

0.1.1

License

none

Unpacked Size

40.7 kB

Total Files

4

Last publish

Collaborators

  • gnu