Я пытаюсь динамически анимировать стилизованный div относительно некоторых других div, число и позиция которых известны только во время выполнения.
Следующий SSCCE отлично работает в Chrome, но не работает ни в Firefox, ни в Edge. Кто-нибудь знает почему?
Я посмотрел на ряд других подобных вопросов без удачи и сказать, что документация anime.js минимальна, вежливо.
import anime from "./anime.es.js";
var pips = document.getElementsByClassName("pip");
var fill = document.querySelector(".pip-fill");
var pipBorder = parseInt(window.getComputedStyle(pips[0]).borderWidth);
fill.style.left = (pips[0].offsetLeft + pipBorder) + "px";
fill.style.top = (pips[0].offsetTop + pipBorder) + "px";
anime({
targets: fill,
left: (pips[2].offsetLeft + pipBorder) + "px",
duration: 1000,
delay: 1000
});
.container {
position: relative;
}
.pip {
display: inline-block;
width: 32px;
height: 32px;
border-style: solid;
border-radius: 100%;
border-width: 4px;
border-color: black;
margin: 64px;
background-color: red;
}
.pip-fill {
position: absolute;
width: 32px;
height: 32px;
border-style: none;
border-radius: 100%;
background-color: black;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./index.css"/>
</head>
<body>
<div class="container">
<div class="pip"></div>
<div class="pip"></div>
<div class="pip"></div>
<div class="pip-fill"></div>
</div>
<script src="./index.js" type="module"></script>
</body>
</html>