Git Product home page Git Product logo

expo-three-demos's Introduction

Demos for Expo and Three.js

The purpose of these demos is to set up a React Native app with a 3D scene. ๐ŸงŠ๐Ÿš€

It should be cross-platform (mobile apps and web) and support mouse and touch input.

Technology stack: Expo, Three.js, OrbitControls, and React-Three-Fiber (optional).

PRs are much appreciated to help make the demos work 100% on all platforms. ๐Ÿ’ช๐Ÿ˜Š

Inspiration

These links serve as inspiration for the demos:

OrbitControls - Mouse and Touch Gestures

OrbitControls defines the mouse and touch gestures that will result in the following actions:

  • Orbit: left mouse / touch: one-finger move
  • Zoom: middle mouse, or mouse-wheel / touch: two-finger spread or squish
  • Pan: right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move

Therefore, these are the expected outcomes in the demos in the app. For each demo is listed the test results.

Demos in the App (with Test Results)

The app has several demos, each using different technologies to set up the 3D scene. Screenshots below.

Three.js demo

  • This uses expo-three-orbit-controls, which was recently upgraded to version 2. As mentioned on that page, the package has some limitations, including some known bugs, plus it uses PanResponder instead of React Native Gesture Handler.
  • The demo is almost identical to the expo-three-orbit-controls example, which uses "standard" Three.js functionality.
  • Test results:
    • Web + Mouse: Orbit: โœ”๏ธ. Zoom: โœ”๏ธ. Pan: โŒ.
    • Web + Touch: Orbit (works, but bad performance): โš ๏ธ. Zoom: โŒ. Pan: โŒ.
    • Mobile + Mouse: Orbit: โœ”๏ธ. Zoom: โŒ. Pan: โŒ.
    • Mobile + Touch: Orbit: โœ”๏ธ. Zoom: โŒ. Pan: โŒ.

Three.js demo (without OrbitControls) (new)

React-Three-Fiber demo

  • This demo uses React-Three-Fiber "on top" of Three.js.
  • It uses the OrbitControls helper from the drei package (only that file is copied into this repository, because adding the whole package as dependency will make the app crash on non-web platforms).
  • Test results:
    • Web + Mouse: Orbit: โœ”๏ธ. Zoom: โœ”๏ธ. Pan: โœ”๏ธ.
    • Web + Touch: Orbit: โœ”๏ธ. Zoom: โœ”๏ธ. Pan: โœ”๏ธ.
    • Mobile + Mouse: Orbit: โŒ. Zoom: โŒ. Pan: โŒ.
    • Mobile + Touch: Orbit: โŒ. Zoom: โŒ. Pan: โŒ.
    • Other: Clicks on the boxes are detected (unrelated to OrbitControls). However, on mobile the click coordinates are off by around 20 pixels in the y-direction (this started appearing after the scene was added to a React Navigation screen).

Screenshots

Screenshots on mobile Screenshots on web

expo-three-demos's People

Contributors

nielsskovgaard avatar

Stargazers

Zachary Ebenfeld avatar Dejan Marjanovic avatar  avatar

Watchers

James Cloos avatar  avatar

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.