Skip to content

Instantly share code, notes, and snippets.

@timocov
Created October 4, 2021 08:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timocov/648966ce5c57492e82864b4d78a7c1cb to your computer and use it in GitHub Desktop.
Save timocov/648966ce5c57492e82864b4d78a7c1cb to your computer and use it in GitHub Desktop.
Safari 15 crash page
<html>
<head>
<script language="javascript">
function init() {
const canvas = document.createElement("canvas");
canvas.style.width = "800px";
canvas.style.height = "600px";
canvas.width = 1600;
canvas.height = 1200;
document.body.appendChild(canvas);
let first = null;
const radius = 2;
const paint = (step) => {
first = first ?? step;
const diff = (step - first) / 50;
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, 1600, 1200);
for (let k = 0; k < 3; k++) {
ctx.fillStyle = ['rgba(76, 175, 80, 0.5)', 'rgba(176, 175, 80, 0.5)', 'rgba(76, 175, 180, 0.5)'][k];
ctx.beginPath();
for (let j = 0; j < 5000; j++) {
const x = 1600 - j * 2 * 0.2;
const y = 300 * (k + 1) + 100 * Math.sin((j + diff) * Math.PI / 500);
ctx.moveTo(x + radius, y);
ctx.arc(x, y, radius, 0, Math.PI * 2, false);
}
ctx.fill();
for (let j = 0; j < 5000; j++) {
const x = 1600 - j * 2 * 0.2;
const y = 300 * (k + 1) + 100 * Math.sin((j + diff) * Math.PI / 500);
const height = Math.random() * 100;
ctx.fillStyle = 'red';
ctx.fillRect(x, x + 0.2, 0.2, height);
}
}
requestAnimationFrame(paint);
};
requestAnimationFrame(paint);
}
</script>
</head>
<body onload="init()"></body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment