css-quad
v0.1.1
Published
Css transform quad
Downloads
4
Readme
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.