GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - operandom/ThreePx: ThreePx synchronises the three.js frustrum with that of the CSS.

BranchesTags
Open more actions menu

Latest commit

 

History

46 Commits
46 Commits

Folders and files

NameName
Last commit message
Last commit date
assets
assets
 
 
docs
docs
 
 
examples
examples
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.jshintrc
.jshintrc
 
 
LICENCE.md
LICENCE.md
 
 
README.md
README.md
 
 
gulpfile.js
gulpfile.js
 
 
package.json
package.json
 
 
yuidoc.json
yuidoc.json
 
 

Repository files navigation

ThreePx

ThreePx synchronises the three.js frustrum with that of the CSS.
So, a 100 by 100 plane with a Z position of 0 and without rotation in three.js has a size of 100px by 100px on the screen. The size of this plane doesn't change when the html wrapper changes it's size.

simple preview simple preview

Installation

Download three.js and ThreePx files and put them in your project folder.
Use Requirejs, Nodejs or a classical html script tag to import.
Show in the examples folder to learn more.

Quick Example

var wrapperElement = document.getElementById('wrapper'),
    threepx = new THREEPX(wrapperElement),
    mesh = new THREE.Mesh(
        // define your mesh
    )
;

threepx.scene.add(mesh);

var lastTimestamp = new Date();

threepx.renderFunction  = function (timestamp, width, height) {

    var delta = timestamp - lastTimestamp,
        angle = 0.02 * delta * 2 * Math.PI / 1000
    ;

    mesh.rotation.x += angle;
    mesh.rotation.y += angle;

    mesh.position.set(100 + width/2, 100 - height/2, 0);

    lastTimestamp = timestamp;

    return true;
}

Requirements

Three.js r66+ and a modern browser with WebGl, requestAnimationFrame() and css transform support.

TODO

  • Add support of perspectiveOrigin
  • Add property change events
  • Add tests
  • Improve code

Developers

Install Gulp and node modules if you want minified the source, YUIDoc to generate the doc.
Testers, devs and ideas are welcome.

Licence

Copyright (c) 2014 Valéry Herlaud. Licensed under the MIT license. See the file LICENSE.md in this distribution for more details.

About

ThreePx synchronises the three.js frustrum with that of the CSS.

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.