-
Notifications
You must be signed in to change notification settings - Fork 0
/
rune.html
283 lines (244 loc) · 7.34 KB
/
rune.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
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>RUNE CHAOS</title>
<link rel="stylesheet" href="./rune.css">
<link rel="shortcut icon" href="rune.ico" type="image/x-icon"/>
</head>
<body>
<!-- partial:index.partial.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>RUNE CHAOS</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.play.min.js"></script> <!-- Added p5.play library -->
<style>
html {
user-select: none; /* Disable text selection */
-webkit-user-select: none; /* For Safari */
-moz-user-select: none; /* For Firefox */
-ms-user-select: none; /* For Internet Explorer/Edge */
}
body {
margin: 0;
padding: 0;
overflow: hidden;
cursor: hidden;
}
#box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 550px;
height: 550px;
border: 10px solid black;
background-color: #fff;
display: flex;
justify-content: center;
align-items: center;
cursor: crosshair; /* Add cursor pointer */
transition: transform 0.2s; /* Add transition for smooth scaling */
}
/* Hover effect for the box */
#box:hover {
transform: translate(-50%, -50%) scale(1.008); /* Scale up by 5% on hover */
}
.runic-art {
width: 400px;
height: 400px;
background-color: #f1f1f1;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
position: relative;
animation: rotate 10s linear infinite;
}
.runic-symbol {
font-size: 40px;
color: #333;
position: absolute;
animation: pulse 2s ease-in-out infinite;
}
.runic-symbol:nth-child(1) {
top: 50px;
left: 50px;
}
.runic-symbol:nth-child(2) {
top: 50px;
right: 50px;
}
.runic-symbol:nth-child(3) {
bottom: 50px;
left: 50px;
}
.runic-symbol:nth-child(4) {
bottom: 50px;
right: 50px;
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes pulse {
0% {
transform: scale(1);
}
50% {
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}
/* CSS class to invert colors, excluding moon button */
.invert-colors:not(#moon-button) {
filter: invert(100%);
}
/* Moon button styling */
#moon-button {
position: absolute;
top: 20px;
left: 20px;
width: 40px;
height: 40px;
background-color: #333;
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
#moon-icon {
font-size: 24px;
color: #fff;
}
</style>
</head>
<body>
<audio id="mouseAudio" preload="auto" volume="0.3" loop>
<source src="noise.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<div id="box" onclick="goToLink()">
<div class="runic-symbol">ᚠ</div>
<div class="runic-symbol">ᚢ</div>
<div class="runic-symbol">ᚦ</div>
<div class="runic-symbol">ᚨ</div>
<p></p>
</div>
<!-- Moon button -->
<div id="moon-button" onclick="toggleInvertColors()">
<span id="moon-icon">🌜</span>
</div>
<script>
// Set up the canvas
let canvas;
let cols, rows;
let cellSize = 20;
// Color palettes
let palettes = [
['#ffcdd2', '#e53935', '#c62828', '#b71c1c'],
['#bbdefb', '#2196f3', '#1565c0', '#0d47a1'],
['#c8e6c9', '#4caf50', '#2e7d32', '#1b5e20'],
['#ffe0b2', '#ff9800', '#f57c00', '#e65100']
];
// Runic alphabet
let runicChars = ['ᚠ', 'ᚢ', 'ᚦ', 'ᚨ', 'ᚱ', 'ᚲ', 'ᚷ', 'ᚹ', 'ᚺ', 'ᚾ', 'ᛁ', 'ᛂ', 'ᛇ', 'ᛈ', 'ᛉ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛖ', 'ᛗ', 'ᛚ', 'ᛜ', 'ᛝ', 'ᛟ', 'ᛞ', 'ᚪ', 'ᚫ', 'ᚣ', 'ᛡ', 'ᛠ'];
// Time-related variables
let lastTime = 0;
let updateInterval = 0.03; // Update every 0.1 seconds
// Initialize the art
function setup() {
canvas = createCanvas(windowWidth, windowHeight);
cols = floor(windowWidth / cellSize);
rows = floor(windowHeight / cellSize);
}
// Draw the art
function draw() {
let currentTime = millis() / 1000; // Get the current time in seconds
let deltaTime = currentTime - lastTime; // Calculate the time since the last update
if (deltaTime >= updateInterval) {
background(255);
// Choose a random color palette
let palette = random(palettes);
// Draw the lines of characters
for (let x = 0; x < cols; x++) {
for (let y = 0; y < rows; y++) {
let xPos = x * cellSize;
let yPos = y * cellSize;
let char = random(runicChars);
// Set the fill color based on the mouse position
if (mouseX > xPos && mouseX < xPos + cellSize && mouseY > yPos && mouseY < yPos + cellSize) {
fill(palette[1]);
} else {
fill(palette[0]);
}
// Draw the character
textSize(cellSize * 0.8);
textAlign(CENTER, CENTER);
text(char, xPos + cellSize / 2, yPos + cellSize / 2);
}
}
lastTime = currentTime; // Update the last update time
}
}
// Resize the canvas when the window is resized
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
cols = floor(windowWidth / cellSize);
rows = floor(windowHeight / cellSize);
}
// JavaScript function to toggle invert colors class and switch moon icon to sun icon
function toggleInvertColors() {
let moonIcon = document.getElementById('moon-icon');
let isSun = moonIcon.innerHTML === '🌞'; // Check if current icon is sun
// Toggle invert colors class
document.body.classList.toggle('invert-colors');
// Toggle moon/sun icon
if (isSun) {
moonIcon.innerHTML = '🌜'; // Change to moon icon
} else {
moonIcon.innerHTML = '🌞'; // Change to sun icon
}
}
// Function to navigate to the desired link
function goToLink() {
window.location.href = "https://magiceden.io/ordinals/marketplace/runechaos"; // Replace "https://www.example.com" with your desired link
}
// Get the audio element
let audio = document.getElementById("mouseAudio");
// Variable to track whether the audio has been played already
let audioPlayed = false;
// Function to play the audio
function playAudio() {
// Check if the audio has not been played yet
if (!audioPlayed) {
// Play the audio
audio.play();
// Set the flag to true to indicate that the audio has been played
audioPlayed = true;
}
}
// Event listener for user interaction (click)
document.addEventListener("click", function(event) {
// Play the audio when the user clicks for the first time
playAudio();
});
</script>
</body>
</html>
<!-- partial -->
<script src="./rune.js"></script>
</body>
</html>