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
13
js/drag.js
13
js/drag.js
|
|
@ -1,10 +1,6 @@
|
|||
const stepSize = 100;
|
||||
const stepSize = 1;
|
||||
const main = document.querySelector('main');
|
||||
|
||||
for(let guideDraggable of document.querySelectorAll("#page-guide main > *")) {
|
||||
guideDraggable.classList.add("draggable");
|
||||
}
|
||||
|
||||
const draggables = document.querySelectorAll(".draggable");
|
||||
const randomStarts = document.querySelectorAll(".randomStart");
|
||||
|
||||
|
|
@ -13,8 +9,8 @@ var zIndex = 2;
|
|||
activateDraggables();
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} n
|
||||
*
|
||||
* @param {number} n
|
||||
* @returns {number}
|
||||
*/
|
||||
function stepedSize(n) {
|
||||
|
|
@ -24,8 +20,6 @@ function stepedSize(n) {
|
|||
function move(e) {
|
||||
e.preventDefault();
|
||||
let target = e.target;
|
||||
target.style['z-index'] = zIndex;
|
||||
zIndex++;
|
||||
|
||||
target.moving = true;
|
||||
|
||||
|
|
@ -75,6 +69,7 @@ function randomizeDragables() {
|
|||
randY = Math.floor(Math.random() * maxY);
|
||||
randomStart.style.left = randX + "px";
|
||||
randomStart.style.top = randY + "px";
|
||||
randomStart.style.rotate = Math.floor(Math.random() * 61) - 30 + "deg";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue