Coder Social home page Coder Social logo

abdulazizsapra / react360-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devcgujrat/react360-demo

1.0 0.0 0.0 24.78 MB

This repository contains official working sample from react 360 demo of tour app, a product by Facebook Inc

JavaScript 99.91% HTML 0.09%

react360-demo's Introduction

TourAppTemplate

TourAppTemplate is a sample app code template for a tour like app with React360. There're also inline comments to guide how each part of the sample code works. This Template includes:

  • Basic UI and interaction and Animation
  • Loading Data via network
  • Display 360 scene and hotspots This sample is designed for use in Facebook Instant Games using the Instant Games SDK."

TourAppTemplate provide two example ways to place hotspots, which you can switch by setting useDynamicSurface to true/false in index.html

  1. Use dynamic surface: (useDynamicSurface = true):
    • This is recommended for most case, it has less limitation and allow you to place hotspots on any position(e.g. on the top or bottom). From performance wise, less than 8 hotspots per scene should works fine on mobile.
    • Each hotspot will be rendered on a different surface, and surface will be place on the right position dynamically by the hotspot setting.
    • You don't need to care about the creating, destroying, placing the surface. TourHotspot uses a custom native view "WorkInProgressSurface", which allow you to create and rotate a surface from react side by using this view.
    • "RCTWorkInProgressSurface" provides a custom native view to create a surface and place it in 3D space from react side.
  2. Use one cylinder surface: (useDynamicSurface = false)
    • If all of you hotspots are in the place that a cylinder surface can cover, and you want simpler layout logic of hotspots that just maps position from 2D space of cylinder layer to the world. You can try this way.
    • It has two limitation: 1. You can't place a hotspot outside of the edge of the cylinder surface, otherwise it will be cropped. 2. There's an edge of cylinder surface on the back, if a hotspot is placed across the edge, it will also get cropped. (This template solves this by placing tooltip of a hotspot on the left if it's close to right edge).
    • It uses the translation on X direction on cylinder layer space to map hotspots' rotation to 3D space.
    • If you want to go with this way, you can remove the RCTWorkInProgressSurface and WorkInProgressSurface related codes.

react360-demo's People

Contributors

waqas-ali-azhar avatar

Stargazers

Abdul Aziz 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.