Coder Social home page Coder Social logo

lozturner / gl-css3d Goto Github PK

View Code? Open in Web Editor NEW

This project forked from deathcap/gl-css3d

0.0 1.0 0.0 251 KB

sync CSS 3D transformations to a WebGL scene

Home Page: http://deathcap.github.io/gl-css3d

License: MIT License

JavaScript 100.00%

gl-css3d's Introduction

gl-css3d

Synchronize CSS 3D transformations to a WebGL scene

screenshot

Usage:

var createCSS3D = require('gl-css3d');

// pass an HTML DOM element node, such as an <iframe>
var css3d = createCSS3D(htmlElement, opts);

// assuming you are using stackgl gl-now/game-shell:

// in the gl-init callback:
css3d.ginit(gl)

// in the gl-resize callback:
css3d.updatePerspective(cameraFOVradians, shell_width, shell_height);

// in the gl-render callback:
css3d.render(view, proj);

For an example embedding an iframe run npm start, or try the live demo. The iframe accepts pointer events and can be interacted with as an ordinary webpage. Click the button to toggle mouse inputs to control the camera instead (drag to move, scroll to zoom; uses game-shell-orbit-camera).

Options

  • planeWidth (2), planeHeight (2): size of the plane in world units

  • tint ([0,0,0,0]): color to draw the WebGL object in front of the CSS3D element, defaults to fully transparent

  • blend (false): whether to enable blending, defaults to false so tint is not influenced by the colors of the WebGL scene behind it

  • flipX (true), flipY (true): whether to invert the X and Y axes from WebGL to CSS3D

  • backface (true): whether to include two extra triangles in the WebGL mesh for the rear side of the plane

References

License

MIT

gl-css3d's People

Contributors

deathcap avatar

Watchers

TriggerT 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.