A web component for
Visual Art & Creative Coding
Empowering CSS as an artistic language
Empowering CSS as an artistic language
A CSS-like language
<css-doodle>
@grid: 16x9 / 100% auto _1px;
transition: @r(1s) ease;
background:@p(
#ff8830, #d1b8a0, #aeced2, #cbdcdf
);
clip-path: polygon(@p(
'0 0, 100% 0, 100% 100%',
'0 0, 100% 0, 0 100%',
'0 0, 100% 100%, 0 100%',
'100% 0, 100% 100%, 0 100%'
));
</css-doodle> Nested, readable, no XML
<css-doodle>
@grid: 1 / 100% auto (16/9);
--c: #b6a8f2, #f2a7b8, #422abf x3, #1c1b1b;
@content: @svg(
viewBox: -57 -57 114 114;
stroke-linejoin: round;
circle*2400 {
fill: @p(--c);
r: $(.37 + abs.sin(8π/@N*@n(-1)*2));
cx, cy: @Plot(
r: 50 + 8*(sin(9t)*tan(14t) + tan(3t));
);
};
);
</css-doodle> No GLSL, runs on the GPU
<css-doodle>
@grid: 1 / 100% auto (16/9);
@content: @pattern(
d: 0;
repeat(60) {
p: vec3(rot(pos, t/4) * d, d + t);
d: d + .7length(fract(p) - .5) - .1;
}
fill: ramp(d / 10,
#fff, #fd7 .1, #e46 .3, #07121f
);
);
</css-doodle> @plot, @shape
<css-doodle>
@grid: 1x2400 / 100% auto (16/9);
font-familiy: monospace;
font-size: 1.6vmin;
color: #999;
@content: @p('O', 'o');
@random(.05) {
@content: '⬮';
font-size: .8em;
color: @p(#d15c49, #372f96);
}
@place: @plot.scatter(
scale: .061 .065;
-x: 1.81(11cos(.6t) + cos(55t) - 2.8);
-y: 2.5(11sin(9.03t) - sin(77t)) + 16;
);
</css-doodle> cssd render
# generate image from css-doodle code
$ cssd render code.css
# make image larger
$ cssd render code.css -x 10
# generate image from codepen
$ cssd render codepen.io/yuanchuan/pen/MQEeJo
# custom selectors
$ cssd render index.html -s '.container'