-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcc.html
59 lines (53 loc) · 1.74 KB
/
cc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Canvas Art</title>
<style>
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(to bottom right, #87CEEB, #FF7F50); /* Nice linear gradient background */
}
canvas {
border: 10px solid rgba(255, 255, 255, 0.5); /* Glassmorphic border */
border-radius: 20px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); /* Glassmorphic shadow */
}
</style>
</head>
<body>
<canvas id="artCanvas" width="400" height="400"></canvas>
<script>
const canvas = document.getElementById('artCanvas');
const ctx = canvas.getContext('2d');
const numRects = 10;
const rectSize = canvas.width / numRects;
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (let i = 0; i < numRects; i++) {
for (let j = 0; j < numRects; j++) {
const x = i * rectSize;
const y = j * rectSize;
const depth = Math.sin((i + j) * 0.1) * 50; // Depth effect
ctx.fillStyle = `rgba(${i * 25}, ${j * 25}, ${(i + j) * 20}, 0.8)`; // Color based on position
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(x + rectSize, y);
ctx.lineTo(x + rectSize, y + rectSize);
ctx.lineTo(x, y + rectSize - depth);
ctx.closePath();
ctx.fill();
}
}
requestAnimationFrame(draw);
}
draw();
</script>
</body>
</html>