1.0.2 • Published 7 years ago

aframe-mirror-component v1.0.2

Weekly downloads
27
License
MIT
Repository
github
Last release
7 years ago

aframe-mirror-component

Version License

Mirror effect material that works with THREE.CubeCamera snapshots of the scene.

Add it to a mesh and it will change its material for a mirror like effect.

If you use it let me know, I'm @alfredofrlp on twitter.

For A-Frame.

Screenshot

API

PropertyDescriptionDefault Value
colormaterial color#ffffff
resolutionCubeCamera resolution128
refractionmaterial refractionRatio0.95
distanceCubeCamera render distance3000
intervalsnapshot interval1000 ms
repeattake snapshot every intervalfalse

For a realtime mirror effect I suggest a low resolution ( 32~64 ) and an interval of 150~300, low distance also helps.

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-mirror-component/dist/aframe-mirror-component.min.js"></script>
</head>

<body>
  <a-scene>
    <a-sphere mirror></a-sphere>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-mirror-component

Then require and use.

require('aframe');
require('aframe-mirror-component');