-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
149 lines (128 loc) · 3.88 KB
/
index.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
<html>
<head>
<script src="http://code.jquery.com/jquery.min.js"></script>
<style>
body{
margin: 0;
overflow: hidden;
}
a{
text-decoration: none;
color: black;
font-size: 57px;
}
div{
z-index: 2013;
margin: 0 auto;
position: fixed;
width: 100%;
text-align: center;
top: 47%;
font-family: Helvetica;
}
</style>
</head>
<body id="brandy">
<div id="nameplate"><a href="mailto:psybuzz@gmail.com">contact me.</a></div>
<script>
var noodles = [];
var inception = function(mark)
{
var count = 0;
var a = Math.random();
console.log(a);
modulo = new Array();
var noori;
//vertical // horizontal
if (a < 0.5)
{
noori = document.createElement('div');
$(noori).css('background-color','rgb('+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+')');
$(noori).css('position','absolute');
$(noori).css('width', window.innerWidth);
$(noori).css('height',Math.floor(Math.random()*window.innerHeight));
$(noori).attr('id', 'd'+levels);
//top or bottom / left or right
if (Math.random() > 0.5)
$(noori).css('top', 0);
else
$(noori).css('bottom', 0);
//(Math.random() > 0.5)? $(noori).css('left',Math.floor(Math.random()*window.innerWidth)) : $(noori).css('right',Math.floor(Math.random()*window.innerWidth));
} else {
noori = document.createElement('div');
$(noori).css('background-color','rgb('+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+','+Math.floor(Math.random()*255)+')');
$(noori).css('position','absolute');
$(noori).css('width',Math.floor(Math.random()*window.innerWidth));
$(noori).css('height', window.innerHeight);
$(noori).attr('id', 'd'+levels);
//top or bottom / left or right
//(Math.random() > 0.5)? $(noori).css('top',Math.floor(Math.random()*window.innerWidth)) : $(noori).css('bottom',Math.floor(Math.random()*window.innerWidth));
if (Math.random() > 0.5)
$(noori).css('left', 0);
else
$(noori).css('right', 0);
}
//add noori to the mark
// $('#'+mark).prepend(noori);
$('#nameplate', '#'+mark).before(noori);
noodles.push(noori);
console.log("added new element to: " + mark);
levels++;
//inception
var dream;
var depth = Math.floor(Math.random()*$('#'+mark).children.length);
if (Math.random() > lower)
{
console.log(mark);
inception(mark);
}
for (var i=0; i<$('#'+mark).children().length; i++)
{
child = $('#'+mark).children()[i];
if (Math.random() > upper && !$(child).is("script"))
{
console.log("mark: " + mark + " has child: : " + $(child).attr('id'));
inception($(child).attr('id'));
}
}
}
var levels = 0;
var lower = 0.3;
var upper = 0.9;
inception('brandy');
//activate all noodles
var randomness = 100;
var chaos = 10;
var decay = 0.95;
$(document).keyup(function(e){
if (e.keyCode == 32){
shift();
}
});
//auto-shift
var a = setInterval(shift, 3000);
function shift(){
$.each(noodles, function(i, item){
var speed = Math.random()*300+500;
randomness += chaos;
chaos *= decay;
if ($(item).css('top') != 'auto'){
$(item).animate({ top: '+='+(Math.random()*randomness-(randomness/2)) }, speed);
}
if ($(item).css('bottom') != 'auto'){
$(item).animate({ bottom: '+='+(Math.random()*randomness-(randomness/2)) }, speed);
}
if ($(item).css('left') != 'auto'){
$(item).animate({ left: '+='+(Math.random()*randomness-(randomness/2)) }, speed);
}
if ($(item).css('right') != 'auto'){
$(item).animate({ right: '+='+(Math.random()*randomness-(randomness/2)) }, speed);
}
$(item).animate({
opacity: Math.random()*0.5+0.5
});
});
}
</script>
</body>
</html>