diff --git a/index.css b/index.css index df00269..3e429b5 100644 --- a/index.css +++ b/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; diff --git a/index.html b/index.html index 9aebae0..8654204 100644 --- a/index.html +++ b/index.html @@ -12,12 +12,15 @@ - +
-
+ + - + \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..d5942a2 --- /dev/null +++ b/index.js @@ -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; +}) diff --git a/soleil.png b/soleil.png new file mode 100644 index 0000000..ed70d4f Binary files /dev/null and b/soleil.png differ