Git Product home page Git Product logo

3d-image's Introduction

๐Ÿ„ 3D-image

NPM 3d-image version R3d-image license

car

Small (2.5kB gzipped), dependency-free library for creating 3D image effect on your website ( just like on Facebook! ).

  • reacts to mouse move / mobile device movement! ๐Ÿคณ (in iOS Safari "motion & orientation access" has to be enabled)
  • based on WebGL shaders
  • uses IntersectionObserver to animate only the images that are currently in the viewport

How to use

First, you need 2 images: original image, and depth image:

car1

Then, prepare image slot with data-src and data-depth-src attributes containing paths to those images:

<div id="car" data-src="path to original image" data-depth-src="path to depth image"></div>

Finally, add 3D-image library and run it like so:

<script src="https://unpkg.com/3d-image"></script>
<script>
    var car = document.getElementById("car");
    image3D.process(car);
</script>

That's it! ๐Ÿฅค

Disclaimer: this library is a work-in-progress, so the API will likely change. There will be more options added like:

  • increasing and decreasing 3D effect strength
  • reacting to scroll events for devices not supporting DeviceOrientation API

Based on the work of Yuriy Artyukh and Keilyn Nunez.

3d-image's People

Contributors

arturbien avatar

Stargazers

 avatar  avatar

Watchers

 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.