klevron / threejs-toys Goto Github PK
View Code? Open in Web Editor NEW✨ ThreeJS Toys ⚡
✨ ThreeJS Toys ⚡
if it possible to put this coursor to wordpress? thank you very much if anybody can help me
Can you add a license to repo and add the license file in order for us to be able to use the package in a compliant manner?
Hi, is there a way to set a unique color for the neon cursors?
Hello @PythonCoderUnicorn, thanks for using this toy !
Any error in console ?
Originally posted by @klevron in #2 (comment)
Hello !
I saw your super awesome example on codepen toy swarm , I absolutely love this code ! Thanks for sharing it.
I copied all of the code into my VS Code folder (index, css, js) but it did not work, unsure why. I have three js installed and have the import function as you have provided. I did see that on threejs it says using node can be problematic, i do have nodejs installed but did not run the code using node. I am sure there is some simple explanation on why that I haven't thought about. Anyway, thanks for sharing.
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected]
for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/threejs-toys/src/cursors/neon/index.js b/node_modules/threejs-toys/src/cursors/neon/index.js
index 93bf7da..1d4ea89 100644
--- a/node_modules/threejs-toys/src/cursors/neon/index.js
+++ b/node_modules/threejs-toys/src/cursors/neon/index.js
@@ -41,10 +41,10 @@ export default function (params) {
three({
...threeConfig,
antialias: false,
- initCamera (three) {
+ initCamera(three) {
three.camera = new OrthographicCamera()
},
- initScene ({ scene }) {
+ initScene({ scene }) {
const geometry = new PlaneGeometry(2, 2)
material = new ShaderMaterial({
uniforms: { uRatio, uSize, uPoints, uColor },
@@ -144,7 +144,7 @@ export default function (params) {
plane = new Mesh(geometry, material)
scene.add(plane)
},
- afterResize ({ width, height }) {
+ afterResize({ width, height }) {
uSize.value.set(config.radius1, config.radius2)
if (width >= height) {
uRatio.value.set(1, height / width)
@@ -154,7 +154,7 @@ export default function (params) {
uSize.value.multiplyScalar(1 / height)
}
},
- beforeRender ({ clock, width, height, wWidth }) {
+ beforeRender({ clock, width, height, wWidth }) {
for (let i = 1; i < config.curvePoints; i++) {
points[i].lerp(points[i - 1], config.curveLerp)
}
@@ -182,7 +182,7 @@ export default function (params) {
velocity.multiplyScalar(0.95)
}
},
- onPointerMove ({ nPosition, delta }) {
+ onPointerMove({ nPosition, delta }) {
hover = true
const x = (0.5 * nPosition.x) * uRatio.value.x
const y = (0.5 * nPosition.y) * uRatio.value.y
@@ -193,7 +193,14 @@ export default function (params) {
velocityTarget.z = Math.sqrt(velocityTarget.x * velocityTarget.x + velocityTarget.y * velocityTarget.y)
velocity.lerp(velocityTarget, 0.05)
},
- onPointerLeave () {
+ onMouseMove({ pageX, pageY }) {
+ if (hover) {
+ const x = (0.5 * pageX) * uRatio.value.x
+ const y = (0.5 * pageY) * uRatio.value.y
+ spline.points[0].set(x, y)
+ }
+ },
+ onPointerLeave() {
hover = false
}
})
This issue body was partially generated by patch-package.
Uncaught TypeError: Cannot read properties of null (reading 'appendChild')
at init (three.js:43:16)
at three (three.js:38:3)
at index$1 (index.js:28:3)
at NewCombin.jsx:5:1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.