Smaller step size, add random rotation, remove z-index increments
This commit is contained in:
parent
bbf60b8ae8
commit
9b307813d6
1 changed files with 4 additions and 9 deletions
|
|
@ -1,10 +1,6 @@
|
||||||
const stepSize = 100;
|
const stepSize = 1;
|
||||||
const main = document.querySelector('main');
|
const main = document.querySelector('main');
|
||||||
|
|
||||||
for(let guideDraggable of document.querySelectorAll("#page-guide main > *")) {
|
|
||||||
guideDraggable.classList.add("draggable");
|
|
||||||
}
|
|
||||||
|
|
||||||
const draggables = document.querySelectorAll(".draggable");
|
const draggables = document.querySelectorAll(".draggable");
|
||||||
const randomStarts = document.querySelectorAll(".randomStart");
|
const randomStarts = document.querySelectorAll(".randomStart");
|
||||||
|
|
||||||
|
|
@ -24,8 +20,6 @@ function stepedSize(n) {
|
||||||
function move(e) {
|
function move(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
let target = e.target;
|
let target = e.target;
|
||||||
target.style['z-index'] = zIndex;
|
|
||||||
zIndex++;
|
|
||||||
|
|
||||||
target.moving = true;
|
target.moving = true;
|
||||||
|
|
||||||
|
|
@ -75,6 +69,7 @@ function randomizeDragables() {
|
||||||
randY = Math.floor(Math.random() * maxY);
|
randY = Math.floor(Math.random() * maxY);
|
||||||
randomStart.style.left = randX + "px";
|
randomStart.style.left = randX + "px";
|
||||||
randomStart.style.top = randY + "px";
|
randomStart.style.top = randY + "px";
|
||||||
|
randomStart.style.rotate = Math.floor(Math.random() * 61) - 30 + "deg";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue