box-shadow-pixels

0.0.4 • Public • Published

npm version npm version

Create box-shadow images & animations

Installation

Using npm:

$ npm install box-shadow-pixels

Why box-shadow-pixels?

box-shadow CSS property allow us to draw a shadow around an element. We can go further and represent an image applying colors with different coordinates...and if we decide to go even further we could create animations using @keyframes.

Origins

This library has been part of the core of pixelartcss, for the sake of keeping everything more modular, this part has been extracted from the main repository. However the library is meant to be generic and useful for other projects as well.

How to use it

The library has a simple API and every method is documented. We basically need a grid or a collection of them together with few options such as the size of the pixel, the duration of the animation, etc. Being able to get a ready to go CSS class:

.my-image-class {
  box-shadow: 70px 10px 0 0 #da974680px 10px 0 0 #cf773090px 10px 0 0 #cf7730, ...
  height: 10px;
  width: 10px;
}

or

.my-animation-class {
  position: absolute;
  animation: 1s infinite;
  -webkit-animation: 1s infinite;
  -moz-animation: 1s infinite;
  -o-animation: 1s infinite;
}
 
@keyframes x {
0%, 25%{
  box-shadow: 5px 5px 0 0 #303f4610px 5px 0 0 #303f4615px 5px 0 0 #303f46, ...
  }
25.01%, 50%{
  box-shadow: 5px 5px 0 0 #303f4610px 5px 0 0 #303f4615px 5px 0 0 #303f46, ...
  }
50.01%, 75%{
  box-shadow: 5px 5px 0 0 #303f4610px 5px 0 0 #303f4615px 5px 0 0 #303f46, ...
  }
75.01%, 100%{
  box-shadow: 5px 5px 0 0 #303f4610px 5px 0 0 #303f4615px 5px 0 0 #303f46, ...
  }
}

Related links

License

MIT Copyright © 2018 Javier Valencia Romero (@jvalen)

Package Sidebar

Install

npm i box-shadow-pixels

Weekly Downloads

14

Version

0.0.4

License

MIT

Unpacked Size

16.8 kB

Total Files

9

Last publish

Collaborators

  • jvalen