-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (22 loc) · 741 Bytes
/
script.js
File metadata and controls
25 lines (22 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import TubesCursor from "https://cdn.jsdelivr.net/npm/threejs-components@0.0.19/build/cursors/tubes1.min.js"
const app = TubesCursor(document.getElementById('canvas'), {
tubes: {
colors: ["#f967fb", "#53bc28", "#6958d5"],
lights: {
intensity: 200,
colors: ["#83f36e", "#fe8a2e", "#ff008a", "#60aed5"]
}
}
})
document.body.addEventListener('click', () => {
const colors = randomColors(3)
const lightsColors = randomColors(4)
console.log(colors, lightsColors)
app.tubes.setColors(colors)
app.tubes.setLightsColors(lightsColors)
})
function randomColors (count) {
return new Array(count)
.fill(0)
.map(() => "#" + Math.floor(Math.random() * 16777215).toString(16).padStart(6, '0'))
}