GithubHelp home page GithubHelp logo

klevron / threejs-toys Goto Github PK

View Code? Open in Web Editor NEW
394.0 6.0 29.0 4.01 MB

✨ ThreeJS Toys ⚡

JavaScript 82.68% HTML 1.11% CSS 0.54% GLSL 14.21% Vue 0.70% TypeScript 0.77%
creative-coding threejs webgl interactive

threejs-toys's People

Contributors

klevron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

threejs-toys's Issues

Wordpress

if it possible to put this coursor to wordpress? thank you very much if anybody can help me

License missing

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?

codepen copy

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.

Fix cursor tracking on pages with overflow: hidden

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.