Extremely Golfed Canvas
d = document
b = d.body
with(
b.appendChild(Object.assign(
d.createElement`canvas`, { width: 100, height: 100 })
).getContext`2d`) {
fillStyle = 'red'
fillRect(5, 5, 20, 20)
}
// slightly more complex example
with(
b.appendChild(Object.assign(
d.createElement`canvas`, { width: 200, height: 200 })
).getContext`2d`) {
fillStyle = '#555', strokeStyle = '#fff', fillRect(0, 0, 200, 200)
for (i = 0; i < 10; i++)
beginPath(), moveTo(20, 20), lineTo(i * 20 + 10, 190), stroke()
}
Easy way to write canvas stuff with very little boilerplate code.