-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
114 lines (97 loc) · 3.7 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
<!DOCTYPE html>
<html lang="fi">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Teekkarispeksi 2015 teaser</title>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="jquery.preload.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Orbitron' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="style.css">
<script>
$(document).ready(function() {
var randomBlinking = false
var images = [
'img/blink_1_b.jpg',
'img/blink_2_b.jpg',
'img/blink_3_b.jpg',
'img/blink_4_b.jpg']
var currentImage
var previousBlinkTime = 0
var blinkThreshold = 500
var $frames
function getBlinkTimeout() {
return (Math.random()*20 + 5)*1000
}
function blink() {
if (!$frames || new Date().getTime() - previousBlinkTime < blinkThreshold)
return
previousBlinkTime = new Date().getTime()
// Position the images on top of the static image
$frames.css("top", $("#eye-wrapper img").offset().top)
$frames.css("left", $("#eye-wrapper img").offset().left)
$frames.css("width", $("#eye-wrapper img").width()+"px")
$frames.css("height", $("#eye-wrapper img").height()+"px")
// Restart animation
currentImage = 0
window.requestAnimationFrame(redraw)
if (randomBlinking)
setTimeout(blink, getBlinkTimeout())
}
function redraw() {
if (currentImage < images.length) {
console.log("Showing frame "+currentImage)
$frames[currentImage].style.display = 'inline'
}
else {
console.log("Hiding frame "+(2*images.length - currentImage))
$frames[Math.max(0, 2*images.length - currentImage - 1)].style.display = 'none'
}
if (currentImage++ < 2*images.length - 1)
window.requestAnimationFrame(redraw)
}
$.preload(images, 1, function(last){
for (var i = 0; i < this.length; i++) {
console.log("Loaded "+this[i])
// Preloading doesn't seem to work well in Safari.
// Insert hidden images to the DOM as a workaround
$("body").append('<img class="animation-frame" src="'+this[i]+'" style="z-index:'+images.indexOf(this[i])+'"/>')
}
if (last) {
$frames = $(".animation-frame")
if (randomBlinking)
setTimeout(blink, getBlinkTimeout())
}
})
if (!randomBlinking) {
$("#eye-wrapper").mouseenter(blink)
$("#eye-wrapper").click(blink)
}
})
</script>
</head>
<body>
<div id="content-wrapper" class="space col-sm-offset-1 col-sm-10 col-lg-offset-2 col-lg-8">
<a href="inner.html">
<div id="pointer-wrapper" class="text-bg text-bg-wrapper page-top-margin">
<div class="pointer-text tule-tanne col-xs-offset-6 col-xs-6 col-sm-offset-8 col-sm-2">
TULE <span class="red">TÄNNE</span>
</div>
</div>
<div id="pointer-tule-tanne" class="pointer pointer-tule-tanne col-xs-offset-6 col-xs-6 col-sm-offset-8 col-sm-2">
<div class="star"></div>
<img src="img/pointer-tule-tanne.png" alt="Tule tänne" />
</div>
</a>
<div id="eye-wrapper" class="col-sm-offset-2 col-sm-8">
<img src="img/blink_1_b.jpg" alt="Silmä" />
</div>
<div id="title" class="text-bg text-bg-wrapper">
<a href="inner.html"><img class="col-sm-offset-1 col-sm-10" src="img/title_nobg.png" alt="Teekkarispeksi 2015" /></a>
</div>
</div>
</body>
</html>