Skip to content

bloodyowl/css-transform-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

css-transform-string

Build Status

browser support

a small helper to ease the construction of the css transform property value

install

$ npm install bloody-csstransformstring

require

var CSSTransformString = require("bloody-csstransformstring")

api

CSSTransformString(object[, object2…]) > string

builds a string for the CSS transform property.

if object is null, returns "none". object can be :

  • a string of CSS transforms (e.g. scale(2) translateX(10%))
  • an object of CSS transforms (e.g. {scale:2, translateX:"10px", translate: ["50%", "50%"]})
  • null, in which case the argument is ignored

example

var transformString = CSSTransformString(
  {scale : 2, rotate : "5deg"},
  {translateY : "-15px"},
  {translate : ["-50%", "-50%"]}
)
// => "scale(2) rotate(5deg) translateY(-15px) translate(-50%,-50%)"

About

a small helper to ease the construction of the css `transform` property value

Resources

License

Stars

Watchers

Forks

Packages

No packages published