From 1a54ab69ef9508e7106c939e5edab9c88a8b04ad Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Fri, 25 Nov 2022 17:41:49 +0100 Subject: [PATCH] modifier example --- index.html | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index ee2d4ee..455e423 100644 --- a/index.html +++ b/index.html @@ -1603,6 +1603,30 @@ function switchSide(){ } } +function cloneAndDistribute(){ + el = document.querySelector("a-box[src]") // page + // trying instead to rely on previously selected matching element and dl2p + + // lack visual feedback to show what is indeed lastly selected or the distance found + //el = selectedElements[selectedElements.length-2] // not current command + times = Math.floor(dl2p*10) // also assume it's been done properly + if (times < 2) times = 7 + + offset = .5 + for (var i = 0; i < times ; i++) { // equivalent of Blender array modifier + let newEl = el.cloneNode() + AFRAME.scenes[0].appendChild(newEl) // takes time... + setTimeout( setZ, 100, {el: newEl, z: -1-i*offset} ) + newEl.addEventListener('hasLoaded', function (event) { + //this.object3D.position.z = i*offset + console.log("loaded") // doesnt seem to happen + }) + } + + function setZ(params){ + params.el.object3D.position.z = params.z + } +} // could change model opacity based on hand position, fading out when within a (very small here) safe space @@ -1637,7 +1661,6 @@ function switchSide(){ pinchsecondary wristattachsecondary="target: #box" > ---> @@ -1645,7 +1668,8 @@ function switchSide(){ - +--> + @@ -1680,9 +1704,11 @@ function switchSide(){ --> + +