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> @shape clips, @plot places
<css-doodle>
@grid: 1x800 / 100% auto (16/9);
font: 1.4vmin monospace;;
color: #333;
@content: @p([Oo]);
@random(.05) {
color: @p(#d15c49, #372f96);
@content: '⬮';
}
@place: @plot.scatter(
intersect {
square {}
shape {
split: 360;
x: .1104(2.8 - 11cos(.6t) - cos(55t));
y: -1.04 - .1625(11sin(9.03t) - sin(77t));
}
}
scale: .86;
move: 0 .05;
);
</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'