-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
100 lines (92 loc) · 3.09 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
<!DOCTYPE html>
<html>
<head>
<title>1f574, LLC</title>
<script src="proton-2.1.0.min.js" type="text/javascript"></script>
</head>
<body onload="resizeCanvas();" onresize="resizeCanvas();">
<div>
<canvas style="position:fixed; top:0; left:0;" id="canvas">
</canvas>
<div style="z-index: 1; position:relative;">
<center>
<h1 id="maninbusinesssuitlevitating">🕴</h1>
<h2>1f574, LLC</h2>
<p>Contract product and engineering management.</p>
<p><a href="mailto:[email protected]">[email protected]</a></p>
</center>
</div>
</div>
<script type="text/javascript">
const canvas = document.getElementById("canvas");
const context = canvas.getContext('2d');
var proton,
renderer,
emitter;
setTimeout(activate, 2000);
function resizeCanvas(){
if (canvas.width < window.innerWidth) {
canvas.width = window.innerWidth;
}
if (canvas.height < window.innerHeight) {
canvas.height = window.innerHeight;
}
if (emitter) {
const box = document.getElementById(
'maninbusinesssuitlevitating').getBoundingClientRect();
emitter.p.x = box.left + box.width / 2;
emitter.p.y = box.top + box.height / 2;
}
}
function activate() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
context.globalCompositeOperation = "lighten";
loadImage();
}
function loadImage() {
var image = new Image()
image.onload = function(e) {
createProton(e.target);
tick();
}
image.src = 'lev3.png';
}
function createProton(image) {
proton = new Proton;
emitter = new Proton.Emitter();
emitter.rate = new Proton.Rate(
new Proton.Span(2, 10), new Proton.Span(2, 4));
emitter.addInitialize(new Proton.ImageTarget(image));
emitter.addInitialize(new Proton.Mass(new Proton.Span(1, 30)));
emitter.addInitialize(new Proton.Life(2, 6));
emitter.addInitialize(
new Proton.V(new Proton.Span(0.5, 1.5),
new Proton.Span(0, 360),
'polar'));
emitter.addBehaviour(
new Proton.Alpha(1, [1, 1], Infinity, Proton.easeInSine));
emitter.addBehaviour(
new Proton.Scale(new Proton.Span(1, 1.5), 0));
emitter.addBehaviour(
new Proton.Color(
'random', 'random', Infinity, Proton.easeInSine));
const box = document.getElementById(
'maninbusinesssuitlevitating').getBoundingClientRect();
emitter.p.x = box.left + box.width / 2;
emitter.p.y = box.top + box.height / 2;
emitter.addBehaviour(
new Proton.Attraction(
new Proton.Vector2D(emitter.p.x, emitter.p.y), 1));
emitter.emit();
proton.addEmitter(emitter);
renderer = new Proton.Renderer('canvas', proton, canvas);
renderer.start();
}
function tick() {
requestAnimationFrame(tick);
proton.update();
}
</script>
</body>
</html>