-
Notifications
You must be signed in to change notification settings - Fork 330
/
Copy pathprettycolours.html
53 lines (40 loc) · 1.43 KB
/
prettycolours.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
<!DOCTYPE HTML>
<html id="html">
<head>
<title>Pretty Colours</title>
<script>function toDegrees (angle) {
return angle * (180 / Math.PI);
}
function sinIt(x) {
return Math.abs(Math.sin(toDegrees(x)));
}
(function() {
document.onmousemove = handleMouseMove;
function handleMouseMove(event) {
event = event;
fontSize = event.pageX/5;
r = sinIt(event.pageX/100000) * 255;
g = sinIt(event.pageY/50000) * 255;
b = sinIt(Math.cos(event.pageX/7500)) * 255;
document.getElementById("html").style.backgroundColor = "rgba(" + r + ", " + g + ", " + b + ", 1)";
// document.getElementById("header").style.color = "rgb(" + g + ", " + r + ", " + b + ")";
// document.getElementById("sub").style.color = "rgb(" + b + ", " + g + ", " + r + ")";
}
}
)();</script>
</head><body>
<style>
@import url('https://fonts.googleapis.com/css?family=Megrim');
html {
background-color: black;
color: white;
font-family: 'Megrim', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
text-align: center;
}
h1 {
font-size: 100px;
}
</style>
<h1 id="header">Pretty Colours</h1>
</body>
</html>