Creating shapes and drawings with CSS.
Sheldon J. Plankton - View demo
Because it's fun.
Note: To use the framework, you'll need to compile your style with the Stylus preprocessor using NodeJS, for more information see NodeJS and Stylus.
Import the library.
@import "da-vinci"
Done ;)
.element
rect(100px, 50px, #eb02dd) /* width, height, color (default #eb02dd) */
.element
circ(50px, #eb02dd) /* radius, color (default = #eb02dd) */
.element
oval(100px, 50px, #eb02dd) /* width, height, color (default = #eb02dd) */
.element
tri(100px, 50px, 50px, #eb02dd) /* top, right, left (default = #eb02dd) */
<div class="canvas">
<div class="art"></div>
</div>
.canvas {
grid(30px, 4, #000) /* cell size, grid size (default = 4), stroke color (default = #000) */
}
.art {
origin(1, 1, 30px, #000) /* row, col, displacement, color (default = #000) */
}
.art {
origin(1, 1, 30px, #000)
box-shadow: pixel(2, 2, 30px, #000); /* row, col, displacement, color (default = #000) */
}
Tip: Create variables and use p( ) > pixel( ).
.art {
a = 30px
origin(1, 1, a)
box-shadow: p(2, 2, a);
}
.art {
a = 30px
origin(1, 1, a)
box-shadow: line(2..6, a, #eb02dd); /* start..end, displacement, color (default = #000) */
}
.art {
a = 30px
origin(1, 1, a)
box-shadow: lineX(2..6, a, #eb02dd); /* start..end, displacement, color (default = #000) */
}
.art {
a = 30px
origin(1, 1, a)
box-shadow: lineY(2..6, a, #eb02dd); /* start..end, displacement, color (default = #000) */
}
Working all together
.canvas {
grid(30px, 6, #ccc)
}
.art {
a = 30px
origin(1, 1, a, #eb02dd)
box-shadow:
pixel(3, 4, a, #eb02dd),
line(2..6, a, purple),
lineY(2..6, a, pink),
lineX(2..6, a, pink);
}
.picture
img("magic.gif", 200px, 200px) /* url, width, height */
.element
rect(100px, 50px, #eb02dd)
pos(10px, 10px, 1) /* x, y, layer(default = 1) */
.picture
img("magic.gif", 200px, 200px)
flip(vertical) /* vertical or horizontal (default = horizontal) */
.picture
img("magic.gif", 200px, 200px)
flip(horizontal) /* vertical or horizontal (default = horizontal) */
.element
rect(100px, 100px, #eb02dd)
clone(110px, 0, #ccc) /* x, y, color (default = #eb02dd) */
.picture
img("unicorn.png", 200px, 200px)
shadow(10px, 10px, 5px, #000) /*X, Y, dissipation, color (default = #000) */
To keep better organization of releases we follow the Semantic Versioning 2.0.0 guidelines.
Find on our roadmap the next steps of the project ;)
Want to contribute? Follow these recommendations.
See Releases for detailed changelog.