diff options
Diffstat (limited to 'src/animation.ml')
-rw-r--r-- | src/animation.ml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/animation.ml b/src/animation.ml new file mode 100644 index 0000000..7a598e5 --- /dev/null +++ b/src/animation.ml @@ -0,0 +1,26 @@ +let mainElt = Document.querySelectorUnsafe "#g-Layout__Main" + +let isRunning = ref false + +let start ~onHidden ~onEnded = + if not !isRunning then + let () = isRunning := true in + let () = Element.setClassName mainElt "g-Layout__HideMain" in + let delay = 200 in + let _ = + Js.Global.setTimeout + (fun () -> + let () = onHidden () in + let () = Element.setClassName mainElt "" in + let _ = + Js.Global.setTimeout + (fun () -> + let () = onEnded () in + isRunning := false) + delay + in + ()) + delay + in + () + else () |