This repository has been archived by the owner on May 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
71 lines (68 loc) · 2.1 KB
/
index.mjs
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
import { Carousel, createApp } from './deps.mjs';
import { angle } from './js/maths.mjs';
const heroText = document.querySelector('#hero-text');
if (!heroText || !(heroText instanceof HTMLElement))
throw new Error('hero text not found');
const rekt = heroText.getBoundingClientRect();
const aX = rekt.left + rekt.width / 2;
const aY = rekt.top + rekt.height / 2;
globalThis.addEventListener('mousemove', (e) => {
const mouseX = e.clientX;
const mouseY = e.clientY;
const an = angle(mouseX, mouseY, aX, aY);
heroText.style.setProperty('--angle', `${an}rad`);
});
const app = createApp({
reviews: [
[
'The Pulitzer Times',
5,
'Of all the space tourism companies out there, none provides as wonderful, as enthralling, as fulfilling an experience as AstroTours. If I had to recommend a space tourism company to a friend, AstroTours would surely be the first.',
],
[
'Addeus Plane, President of the Space Racers hobby group',
5,
"As someone who avidly pursues space tourism as a hobby, after my experience with AstroTours, I don't think I will ever go back to another company.",
],
[
'Sam Liyanage',
4,
'I ate before the flight because nowhere did it tell me not to. I ended up vomiting all over my crush. 4/5 view was nice.',
],
['Jean Rousseau', 5, 'Best experience ever.'],
[
'Anne Pluto',
5,
"What more to say? It's the greatest space tour you'll ever have. 100% absolutely recommend.",
],
[
'Luke Rene',
5,
"I'm a simple man. I like to look up at the stars. This allowed me to look up at the stars. So 5/5.",
],
['Nickel Herbert', 4, 'I would give it a 5/5, but Luke Rene already did.'],
],
retreatCarousel() {
carousel.prev();
},
advanceCarousel() {
carousel.next();
},
pauseCarousel() {
carousel.pause();
},
playCarousel() {
carousel.cycle();
},
});
app.mount('#main');
/** @type {HTMLElement[]} */
const els = Array.from(document.querySelectorAll('.home-review-carousel-item'));
const carousel = new Carousel(
els.map((el, i) => ({ el, position: i })),
{
interval: 6000,
}
);
carousel.cycle();
document.addEventListener('page-change', app.unmount);