<script type="module">
import { swarmBackground } from 'https://unpkg.com/threejs-toys@0.0.8/build/threejs-toys.module.cdn.min.js'
const bg = swarmBackground({
el: document.querySelector('.particles'),
eventsEl: document.querySelector('.particles'),
gpgpuSize: 128,
colors: ['#ffffff', '#ffffff'],
geometry: 'default'
})
bg.three.camera.position.set(0, 0, 200)
bg.three.renderer.setClearColor( '#000000', 1 )
document.querySelector('#rec538438370').addEventListener('click', (element) => {
bg.setColors([Math.random() * 0xffffff, Math.random() * 0xffffff])
})
var interact = false
document.querySelector('#rec538438370').addEventListener('dblclick', (element) => {
if (interact === false) {
interact = true
document.querySelector('.particles').classList.add('interact')
}
else {
interact = false
document.querySelector('.particles').classList.remove('interact')
}
})
</script>
<style>
canvas[data-engine="three.js r140"] {
position: absolute;
z-index: -1;
top: 0px;
left: 0px;
overflow: hidden;
height: unset !important;
}
.interact {
pointer-events: auto !important;
}
.particles {
pointer-events: none;
}
.unselect {
user-select: none;
}
</style>