There was an error while loading. Please reload this page.
1 parent 5330417 commit 1027dc4Copy full SHA for 1027dc4
28-VideoSpeedController/finish.html
@@ -15,6 +15,23 @@
15
</div>
16
17
<script>
18
+ const speed = document.querySelector('.speed');
19
+ const bar = speed.querySelector('.speed-bar');
20
+ const video = document.querySelector('.flex');
21
+
22
+ function handleMove(event) {
23
+ const pageY = event.pageY - this.offsetTop;
24
+ const percent = pageY / this.offsetHeight;
25
+ const min = 0.5;
26
+ const max = 4;
27
+ const height = `${Math.round(percent * 100)}%`;
28
+ const playbackRate = ((percent * (max - min)) + min);
29
+ bar.style.height = height;
30
+ bar.textContent = `${playbackRate.toFixed(2)}x`;
31
+ video.playbackRate = playbackRate;
32
+ }
33
34
+ speed.addEventListener('mousemove', handleMove);
35
</script>
36
</body>
37
</html>
0 commit comments