tarpin bien
This commit is contained in:
16
index.css
16
index.css
@ -2,6 +2,7 @@ body {
|
||||
margin: 0;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.container {
|
||||
@ -16,9 +17,20 @@ div.container {
|
||||
animation: rainbow 6s linear infinite;
|
||||
}
|
||||
|
||||
img#sun {
|
||||
cursor: pointer;
|
||||
filter: drop-shadow(12px 12px 12px rgba(0, 0, 0, 0.5));
|
||||
transition: 0.3s ease;
|
||||
}
|
||||
|
||||
img#sun:hover {
|
||||
filter: drop-shadow(36px 36px 12px rgba(0, 0, 0, 0.3));
|
||||
transform: scale(1.05) skew(4deg, -3deg);
|
||||
}
|
||||
|
||||
video {
|
||||
display: flex;
|
||||
margin: 200px;
|
||||
display: none;
|
||||
margin: 300px;
|
||||
max-width: 1920px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
|
@ -12,12 +12,15 @@
|
||||
<meta property="og:description" content="La Météo Rance (fé chaud)" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body id="body">
|
||||
<div class="container">
|
||||
<video autoplay controls>
|
||||
<img id="sun" src="soleil.png" />
|
||||
<video>
|
||||
<source src="tarpinchaud.webm" type="video/webm">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<script src="index.js" type="text/javascript"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
57
index.js
Normal file
57
index.js
Normal file
@ -0,0 +1,57 @@
|
||||
const body = document.getElementById('body')
|
||||
const media = document.querySelector("video");
|
||||
const sun = document.getElementById('sun')
|
||||
|
||||
let saturation = 1;
|
||||
let freq = 1000;
|
||||
let gain = 0;
|
||||
let audioSource = null;
|
||||
let filter = null;
|
||||
|
||||
function showVideo() {
|
||||
sun.style.display = 'none';
|
||||
media.style.display = 'flex';
|
||||
}
|
||||
|
||||
function hideVideo() {
|
||||
sun.style.display = 'flex';
|
||||
media.style.display = 'none';
|
||||
}
|
||||
|
||||
function increaseValues() {
|
||||
saturation += 1;
|
||||
gain += 5;
|
||||
freq += 1000;
|
||||
}
|
||||
|
||||
function createFilter() {
|
||||
if (audioSource === null) {
|
||||
const context = new AudioContext();
|
||||
audioSource = context.createMediaElementSource(media);
|
||||
filter = context.createBiquadFilter();
|
||||
audioSource.connect(filter);
|
||||
filter.connect(context.destination);
|
||||
filter.type = "lowshelf";
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
sun.addEventListener('click', (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const filter = createFilter();
|
||||
filter.frequency.value = freq;
|
||||
filter.gain.value = gain;
|
||||
|
||||
showVideo();
|
||||
media.play();
|
||||
media.style.filter = `saturate(${saturation})`;
|
||||
|
||||
increaseValues();
|
||||
})
|
||||
|
||||
media.addEventListener('ended', () => {
|
||||
hideVideo();
|
||||
media.currentTime = 0;
|
||||
})
|
BIN
soleil.png
Normal file
BIN
soleil.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Reference in New Issue
Block a user