-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
108 lines (94 loc) · 2.7 KB
/
script.js
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
// APHORISMS
const aphorisms = [
{
aphorism:
"Coding is not just a job, it's an art form. Keep refining your craft and creating masterpieces.",
author: 'Unknown',
},
{
aphorism: 'The best way to predict the future is to invent it.',
author: 'Alan Kay',
},
{
aphorism:
'Programs must be written for people to read, and only incidentally for machines to execute.',
author: 'Harold Abelson',
},
{
aphorism: "Code is like humor. When you have to explain it, it's bad.",
author: 'Cory House',
},
{
aphorism:
"Programming isn't about what you know, it's about what you can figure out.",
author: 'Chris Pine',
},
{
aphorism: 'Good code is its own best documentation.',
author: 'Steve McConnell',
},
{
aphorism: 'The only way to do great work is to love what you do.',
author: 'Steve Jobs',
},
{
aphorism: 'Code is read much more than it is written. Plan accordingly.',
author: 'Unknown',
},
{
aphorism:
'A good programmer is someone who always looks both ways before crossing a one-way street.',
author: 'Doug Linder',
},
{
aphorism:
'Perfection is achieved not when there is nothing more to add, but rather when there is nothing more to take away.',
author: 'Antoine de Saint-Exupéry',
},
]
const randomAphorism = aphorisms[Math.floor(Math.random() * aphorisms.length)]
const aphorismOutput = document.querySelector('#aphorismOutput')
const authorOutput = document.querySelector('#authorOutput')
aphorismOutput.innerHTML = '"' + randomAphorism.aphorism + '"'
authorOutput.innerHTML = '- ' + randomAphorism.author
// STARS
function createStars() {
const sky = document.querySelector('.sky')
count = 0
while (count <= 300) {
count++
const star = document.createElement('div')
// star.innerHTML = "";
sky.appendChild(star)
star.classList.add('stars')
star.style.left = Math.floor(Math.random() * 1440) + 'px'
star.style.top = Math.floor(Math.random() * window.innerHeight) + 'px'
// star.style.transform = "scale(Math.floor(Math.random() * 2))"
star.style.transform =
'scale(' + ((Math.random() * 20) / 10).toFixed(2) + ')'
}
}
createStars()
// CLOUDS
function moveClouds1() {
const cloud1 = document.querySelector('.cloud-1')
let pos = 0
const id = setInterval(frame, 60)
function frame() {
pos++
cloud1.style.backgroundPosition = pos + 'px'
// clearInterval(id);
}
}
moveClouds1()
function moveClouds2() {
const cloud2 = document.querySelector('.cloud-2')
let pos = 0
const id = setInterval(frame, 60)
function frame() {
pos--
cloud2.style.backgroundPosition = pos + 'px'
// clearInterval(id);
}
}
moveClouds2()