-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSpotlight.astro
More file actions
158 lines (135 loc) · 3.65 KB
/
Copy pathSpotlight.astro
File metadata and controls
158 lines (135 loc) · 3.65 KB
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
150
151
152
153
154
155
156
157
158
---
import { Image } from "astro:assets";
import UzhLogo from "../assets/logos/uzh-logo.svg";
import Video from "../assets/videos/quassel.mp4";
import Poster from "../assets/videos/poster.png";
import PlayButtonSymbol from "../assets/videos/play-button-symbol.svg";
---
<style>
section {
display: flex;
flex-direction: column;
align-items: center;
background: radial-gradient(50% 50% at 50% 50%, var(--color-primary) 60%, transparent 100%);
font-size: var(--font-size-lg);
}
h1 {
font-size: var(--font-size-xxxl);
}
h2 {
font-size: var(--font-size-lg);
font-weight: var(--font-weight-medium);
align-self: center;
}
.intro {
text-align: center;
margin-bottom: var(--spacing-lg);
padding: var(--spacing-sm) var(--spacing-xl);
max-width: 37rem;
}
.video-wrapper {
display: flex;
align-items: center;
justify-content: center;
position: relative;
width: 100%;
}
video {
width: 100%;
height: auto;
box-shadow: 0 0 4rem var(--color-card);
margin-inline: var(--spacing-xl);
}
.video-not-interactive {
pointer-events: none;
}
video::-webkit-media-controls-panel {
background-image: none;
filter: brightness(0.2);
}
.play-button {
position: absolute;
cursor: pointer;
top: 50%;
left: 50%;
translate: -50% -50%;
transform-origin: center center;
width: clamp(3rem, 10vw, 6rem);
}
.play-button.hidden {
visibility: hidden;
}
.play-button:hover {
transform: scale(1.1);
}
.used-by {
margin-top: var(--spacing-xl);
display: flex;
gap: var(--spacing-lg);
@media (max-width: 640px) {
flex-direction: column;
gap: 0;
}
}
.used-by img {
max-height: 4rem;
}
.used-by a :hover {
transform: scale(1.03);
}
</style>
<script>
document.addEventListener("DOMContentLoaded", () => {
const video = document.querySelector("video") as HTMLVideoElement;
const playButton = document.querySelector(".play-button") as HTMLButtonElement;
let ignoreNextClick = false;
let videoPlaying = false;
video.controls = false;
const updatePlayButtonVisibility = () => {
const showPlayButton = video.paused && !video.seeking;
playButton.classList.toggle("hidden", !showPlayButton);
};
playButton.addEventListener("click", (e) => {
e.stopPropagation();
ignoreNextClick = true;
video.controls = true;
videoPlaying = true;
video.play();
});
if (videoPlaying) {
video.addEventListener("click", () => {
if (ignoreNextClick) {
ignoreNextClick = false;
return;
}
if (video.paused) {
video.controls = true;
video.play();
} else {
video.pause();
}
});
}
video.addEventListener("play", updatePlayButtonVisibility);
video.addEventListener("pause", updatePlayButtonVisibility);
video.addEventListener("seeking", updatePlayButtonVisibility);
video.addEventListener("seeked", updatePlayButtonVisibility);
updatePlayButtonVisibility();
});
</script>
<section>
<div class="intro">
<h1>Gather language exposure data</h1>
<p>Efficient documenting <strong>children's</strong> language exposure by carer, language and time.</p>
</div>
<div class="video-wrapper">
<video poster={Poster.src} muted playsinline>
<source src={Video} type="video/mp4" />
</video>
<Image class="play-button" src={PlayButtonSymbol} alt="Play button symbol" />
</div>
<div class="used-by">
<h2>Used by</h2>
<a href="https://www.uzh.ch/en.html"><Image src={UzhLogo} alt="University of Zurich" /></a>
</div>
</section>