We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91c8865 commit 939cff1Copy full SHA for 939cff1
28 - Video Speed Controller/index-START.html
@@ -15,6 +15,22 @@
15
</div>
16
17
<script>
18
+ const speed = document.querySelector('.speed');
19
+ const bar = document.querySelector('.speed-bar');
20
+ const video = document.querySelector('.flex');
21
+
22
+ speed.addEventListener('mousemove', function(e) {
23
+ const y = e.pageY - this.offsetTop;
24
+ const percent = y / this.offsetHeight;
25
+ const min = 0.4;
26
+ const max = 4;
27
+ const height = Math.round(percent * 100) + '%';
28
+ const playbackRate = percent * (max - min) + min;
29
+ bar.textContent = playbackRate.toFixed(1) + 'x';
30
+ bar.style.height = height;
31
32
+ video.playbackRate = playbackRate;
33
+ });
34
</script>
35
</body>
36
</html>
0 commit comments