cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <canvas id="canvas" width="1500" height="800">
              body {
canvas {
  border:1px solid black;
              const cdims = {height:800, width:1500};
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext('2d');

ctx.fillRect(0,0, cdims.width, cdims.height);

function drawCircle(x, y, r) {
  ctx.arc(x, y, r, 0, 2*Math.PI);
function random_range(min, max) {
  return Math.random()*(max-min)+min;

function makeSplat(startx, starty) {

  let image_scale = Math.random()*0.66+0.33;

  let moveDir = Math.random()*360;
  let moveSpd = random_range(3, 12);
  //let fric = random_range(moveSpd/8, moveSpd/2);

  let sizeChange = random_range(image_scale/10, image_scale/3);

  let destroyed = false;
  let x = startx; 
  let y = starty;
  ctx.globalAlpha = 0.6;
  let startRadius = random_range(10, 20);
  while(!destroyed) {
    drawCircle(x, y, startRadius*image_scale);


    if(moveSpd>0) {
      ctx.globalAlpha -= random_range(0.05, 0.1);



    if(image_scale<0) {
      destroyed = true;

function makeSplatter(x, y) {
  ctx.fillStyle = `hsl(${Math.random()*360}, 70%, 50%)`;
  let bound = random_range(4, 12);
  for(let i=0; i<bound; i++) {
    makeSplat(x+Math.random()*16, y+Math.random()*16);

$('canvas').click(function(e) {
  var ex = event.pageX-$(this).offset().left;
  var ey = event.pageY-$(this).offset().top;
  makeSplatter(ex, ey);

for(var i=0; i<10; i++) {
  makeSplatter(Math.random()*cdims.width, Math.random()*cdims.height);
Loading ..................