add mixbox for javascript

This commit is contained in:
Ondrej Jamriska
2022-09-21 05:05:21 +02:00
parent ee38da6176
commit 4bfc462204
18 changed files with 3057 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<canvas id="canvas" width="720" height="128"></canvas>
<script src="https://scrtwpns.com/mixbox.js"></script>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
var color1 = "rgb(0, 33, 133)"; // blue
var color2 = "rgb(252, 211, 0)"; // yellow
var n = canvas.width;
for (var i = 0; i < n; i++) {
context.fillStyle = mixbox.lerp(color1, color2, i / (n - 1));
context.fillRect(i, 0, 1, canvas.height);
}
</script>
</body>
</html>