Skip to content

Add/remove individual transformations from a CSS transform style

License

Notifications You must be signed in to change notification settings

hughsk/transform-stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

transform-stack Flattr this!experimental

Add/remove individual transformations from a DOM node's CSS transform style, with the hopes of minimising interference with other transforms being applied from other parts of your code.

Usage

transform-stack

push = transform(node)

Create a new transform stack for node.

pop = push(value)

Appends a new transform operation of value to the node's transform style. This should just be a string, e.g. translate(50px, 0).

Returns a pop function, which you can use to remove the transform later.

pop()

Removes the previously applied transform. Note: if you have two transforms of exactly the same type and values, you may run into issues with transform order.

push()

When calling push with no arguments, you will be given an array in return that contains each transform in the stack, e.g.:

[
    "translate(50px, 0)"
  , "rotate(45deg)"
  , "scale(0.5, 0.5)"
]

License

MIT. See LICENSE.md for details.

About

Add/remove individual transformations from a CSS transform style

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published