diff options
author | Aki <please@ignore.pl> | 2021-05-27 19:26:36 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-05-27 19:26:36 +0200 |
commit | 60441671ea239c01f0ce91314983823a8692f219 (patch) | |
tree | 375f72e80a82f72740698c7346aa3703b4017ee3 | |
parent | 153a747efc84aa57fa38003284b0e80bed62e0f0 (diff) | |
download | derelict-prototype-60441671ea239c01f0ce91314983823a8692f219.zip derelict-prototype-60441671ea239c01f0ce91314983823a8692f219.tar.gz derelict-prototype-60441671ea239c01f0ce91314983823a8692f219.tar.bz2 |
Added tip to progress to indicate hover
-rw-r--r-- | derelict.js | 3 | ||||
-rw-r--r-- | style.css | 24 |
2 files changed, 25 insertions, 2 deletions
diff --git a/derelict.js b/derelict.js index 1484c55..bc6e17e 100644 --- a/derelict.js +++ b/derelict.js @@ -184,18 +184,21 @@ function processBattle({battle, renderer, renderer2d, container, toolbar, skybox const bottomBar = document.createElement("div") const seekbar = document.createElement("div") const progress = document.createElement("div") + const tip = document.createElement("div") const play = document.createElement("button") bottomBar.classList.add("bottom-bar") seekbar.classList.add("seekbar") seekbar.draggable = true progress.classList.add("progress") progress.style.width = "0%" + tip.classList.add("tip") play.innerText = "Play" container.appendChild(bottomBar) bottomBar.appendChild(play) bottomBar.appendChild(seekbar) seekbar.appendChild(progress) + progress.appendChild(tip) let current = start let isPlaying = false @@ -197,15 +197,35 @@ body { z-index: 10000; } -.bottom-bar .seekbar { +.seekbar { width: 100%; height: 0.5em; background: #333; cursor: pointer; } -.bottom-bar .seekbar .progress { +.seekbar .progress { + position: relative; height: 100%; background: #bf1041; pointer-events: none; } + +.seekbar .progress .tip { + position: absolute; + right: 0; + width: 0; + height: 0; + top: 0.25em; + border-radius: 100%; + background: #bf1041; + box-shadow: 0 2px 3px -1px #000; + transition: width 0.2s, height 0.2s, right 0.2s, top 0.2s; +} + +.seekbar:hover .progress .tip { + width: 0.9em; + height: 0.9em; + right: -0.45em; + top: -0.2em; +} |