I want to create a spinning loading overlay similar to those in RPG games for character skills. Here is an example from WoW that I'm aiming for;
https://i.sstatic.net/UhQoY.gif
This is my attempt (my CSS skills are not quite up to par) - as you can see, it looks a bit off.
https://i.sstatic.net/dWpP9.png
If you have any ideas on how to achieve this, I'd appreciate the help!
The source is in ClojureScript, but I believe it shouldn't be a problem;
(def skill-keyframes-opa
((keyframes (j/lit {"0%" {:opacity "1"}
"50%, 100%" {:opacity "0"}}))))
(def skill-loading-wrapper
(css (j/lit {:background :white
:opacity 0.5
:z-index 1
:width 45
:height 45
:position :relative
:top 2
:left 2})))
(def skill-loading-pie
(css (j/lit {:width "50%"
:height "100%"
:position :absolute
:transform-origin "100% 50%"
:background :grey
:border "10px solid rgba (0, 0, 0, 0.4)"})))
(defn- skill-loading-spinner [duration]
((css (j/lit {:border-radius "100% 0 0 100% / 50% 0 0 50%"
:z-index 200
:border-right :none
:animation (str skill-keyframes-rota " " duration "s linear infinite")}))))
(defn- skill-loading-filler [duration]
((css (j/lit {:border-radius "0 100% 100% 0 / 0 50% 50% 0"
:z-index 100
:border-left :none
:animation (str skill-keyframes-opa " " duration "s steps(1, end) infinite reverse")
:left "50%"
:opacity 0}))))
(defn skill-loading-mask [duration]
((css (j/lit {:width "50%"
:height "100%"
:position :absolute
:z-index 300
:opacity 1
:background :inherit
:animation (str skill-keyframes-opa " " duration "s steps(1, end) infinite")}))))
(defn use-skill [duration]
[:div {:class (skill-loading-wrapper)}
[:div {:class [(skill-loading-pie) (skill-loading-spinner duration)]}]
[:div {:class [(skill-loading-pie) (skill-loading-filler duration)]}]
[:div {:class (skill-loading-mask duration)}]])