summaryrefslogtreecommitdiff
path: root/isometric/index.html
blob: 04c7cc9ba7b28d4757f6d5c35f37bf1cbe6e6687 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Isometric Triangles</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=VT323&family=Fredoka:wght@400;600&display=swap"
        rel="stylesheet">
    <script src="https://cdn.usefathom.com/script.js" data-site="YZVJPTBZ" defer></script>
    <style>
        body,
        html {
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            background-color: #c1a5e8;
            font-family: 'Fredoka', sans-serif;
        }

        .triangle {
            position: absolute;
            width: 0;
            height: 0;
            border-style: solid;
            opacity: 0.8;
            transform-origin: center;
            animation: float 20s infinite ease-in-out;
            image-rendering: pixelated;
        }

        /* Create isometric triangle using clip-path instead of borders */
        .isometric {
            width: 100px;
            height: 100px;
            background-color: rgba(255, 255, 255, 0.9);
            border: none;
            clip-path: polygon(50% 0%, 100% 75%, 0% 75%);
            transform-style: preserve-3d;
            perspective: 800px;
            filter: drop-shadow(2px 2px 0 rgba(90, 61, 92, 0.3));
        }

        @keyframes float {
            0% {
                transform: translateY(0) rotate(0deg) scale(1);
            }

            25% {
                transform: translateY(-20px) rotate(90deg) scale(1.05);
            }

            50% {
                transform: translateY(0) rotate(180deg) scale(1);
            }

            75% {
                transform: translateY(20px) rotate(270deg) scale(0.95);
            }

            100% {
                transform: translateY(0) rotate(360deg) scale(1);
            }
        }

        .content {
            position: relative;
            z-index: 10;
            color: #5a3d5c;
            text-align: center;
            font-family: 'Fredoka', sans-serif;

            /* Center vertically and horizontally */
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 100%;
            background-color: rgba(255, 255, 255, 0.7);
            padding: 20px;
            border-radius: 20px;
            border: 5px dashed #ff6ec4;
            box-shadow: 5px 5px 0px #7873f5;
            max-width: 500px;
            margin: 0 auto;
        }

        h1 {
            font-family: 'VT323', monospace;
            font-size: 3.5rem;
            text-shadow: 3px 3px 0px rgba(255, 110, 196, 0.5);
            margin-bottom: 1rem;
            color: #5a3d5c;
            letter-spacing: 2px;
        }

        .back-link {
            position: absolute;
            top: 20px;
            left: 20px;
            z-index: 100;
            color: #5a3d5c;
            text-decoration: none;
            background: rgba(255, 255, 255, 0.8);
            padding: 10px 15px;
            border-radius: 10px;
            font-family: 'VT323', monospace;
            font-size: 18px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 5px;
            border: 3px solid #ff6ec4;
            box-shadow: 3px 3px 0px #7873f5;
        }

        .back-link:hover {
            background: rgba(255, 255, 255, 1);
            transform: translateY(-3px);
            box-shadow: 5px 5px 0px #7873f5;
        }

        .back-link::before {
            content: "←";
            font-size: 22px;
        }
    </style>
</head>

<body>
    <a href="../index.html" class="back-link">Back to Home</a>

    <div class="content">
        <h1>Isometric Triangles</h1>
        <p>Move your mouse around to create more cute triangles! ✨</p>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function () {
            console.log("DOM loaded, creating triangles");

            const colors = [
                '#ff6ec4', '#7873f5', '#c1a5e8', '#ffd6e0',
                '#ffecf1', '#5a3d5c', '#7c5295', '#ffb3d1',
                '#b3f5ff', '#b3ffcc', '#ffffb3', '#ffccb3',
                '#ffb3ff', '#b3b3ff', '#ffffff', '#ffa6c9'
            ];

            const windowWidth = window.innerWidth;
            const windowHeight = window.innerHeight;
            const triangleCount = Math.max(50, Math.floor((windowWidth * windowHeight) / 10000));

            console.log(`Creating ${triangleCount} triangles for window size ${windowWidth}x${windowHeight}`);

            // Create triangles using DOM elements with isometric perspective
            for (let i = 0; i < triangleCount; i++) {
                createIsometricTriangle();
            }

            function createIsometricTriangle() {
                const triangle = document.createElement('div');
                triangle.className = 'triangle isometric';

                // Random size between 50 and 150
                const size = 50 + Math.random() * 100;

                // Random position
                const left = Math.random() * windowWidth;
                const top = Math.random() * windowHeight;

                // Random color
                const color = colors[Math.floor(Math.random() * colors.length)];

                // Random rotation for isometric effect
                const rotateX = -30 + Math.random() * 60; // -30 to 30 degrees
                const rotateY = -30 + Math.random() * 60; // -30 to 30 degrees
                const rotateZ = Math.random() * 360;      // 0 to 360 degrees

                // Random animation duration
                const duration = 10 + Math.random() * 40;

                // Random direction
                const direction = Math.random() > 0.5 ? 'normal' : 'reverse';

                // Set triangle properties
                triangle.style.left = `${left}px`;
                triangle.style.top = `${top}px`;
                triangle.style.width = `${size}px`;
                triangle.style.height = `${size}px`;
                triangle.style.backgroundColor = color;
                triangle.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg)`;
                triangle.style.animationDuration = `${duration}s`;
                triangle.style.animationDirection = direction;

                // Add to body
                document.body.appendChild(triangle);
                console.log(`Created isometric triangle at (${left}, ${top}) with size ${size} and color ${color}`);
            }

            // Add some triangles when mouse moves
            document.addEventListener('mousemove', function (e) {
                if (Math.random() < 0.05) { // 5% chance to create a triangle on mouse move
                    const triangle = document.createElement('div');
                    triangle.className = 'triangle isometric';

                    const size = 50 + Math.random() * 100;
                    const color = colors[Math.floor(Math.random() * colors.length)];

                    // Random rotation for isometric effect
                    const rotateX = -30 + Math.random() * 60;
                    const rotateY = -30 + Math.random() * 60;
                    const rotateZ = Math.random() * 360;

                    triangle.style.left = `${e.clientX - size / 2}px`;
                    triangle.style.top = `${e.clientY - size / 2}px`;
                    triangle.style.width = `${size}px`;
                    triangle.style.height = `${size}px`;
                    triangle.style.backgroundColor = color;
                    triangle.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) rotateZ(${rotateZ}deg)`;
                    triangle.style.animationDuration = `${10 + Math.random() * 40}s`;
                    triangle.style.animationDirection = Math.random() > 0.5 ? 'normal' : 'reverse';

                    document.body.appendChild(triangle);
                }
            });

            // Handle window resize
            window.addEventListener('resize', function () {
                // Clear all existing triangles
                const existingTriangles = document.querySelectorAll('.triangle');
                existingTriangles.forEach(triangle => {
                    document.body.removeChild(triangle);
                });

                // Create new triangles based on new window size
                const newWindowWidth = window.innerWidth;
                const newWindowHeight = window.innerHeight;
                const newTriangleCount = Math.max(50, Math.floor((newWindowWidth * newWindowHeight) / 10000));

                for (let i = 0; i < newTriangleCount; i++) {
                    createIsometricTriangle();
                }
            });

            console.log("Initialization complete");
        });
    </script>
</body>

</html>