1.0.3 • Published 4 years ago

threevision v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

threevision

NPM package Build Size Dependencies

An interactive trivision display for three.js.

Demo

Based on traditional trivision billboards, but this digital version allows for more than three different images or even videos to be displayed. If more than three textures are supplied, the texture shifting takes place on the backside of the display during the prisms rotation. For an example integration in three.js, check out the demo sourcecode from the examples directory.

trivision-image

Quick start

import Threevision from 'threevision';

or

var Threevision = require('threevision');

or even

<script src="https://unpkg.com/threevision"></script>

then

//prepare some materials
var materials = []

var texture = new THREE.TextureLoader().load("someImage.jpg");
materials.push(new THREE.MeshBasicMaterial({ map: texture }));

var color = new THREE.Color("hsl(100, 75%, 50%)");
materials.push(new THREE.MeshBasicMaterial({ color: color }));

//create a threevision
var threevision = new Threevision({materials, width: 100, height: 100});
var myScene = new THREE.Scene();
myScene.add(threevision);

//make threevision shift avery 2 seconds
let stepCounter = setInterval(() => {threevision.step = step; step += 1;}, 2000);

//in animation loop
(function animate(){
    threevision.update();
    })();

API reference

Constructor

Threevision (materials, width, height)

Properties

PropertyDescriptionDefault
materialsArray with containing Three.js textures. This is what will be displayed. See the example for how to display images, videos or colors.
widthThe width of the threevision display.100
heightThe height of the threevision display.100
stepIndex of the material to be facing frontwards. Changing step makes the threevision display rotate.0
prismCountThe amount of prism elements of the threevision display.24
verticalThe orientation of the prisms.false
easingThe easing of the prisms rotations.0.05
speedThe max speed of the prisms rotations.1
mouseOverEffectApplies a mouse-over effect that adds a wave-like animation.false
shadowsIf the THREE.Scene is prepared for shadows, the threevision displays shadow behavior can be manually switched on/off.true

Animation update

threevision.update(scene,camera,mousePos)`

PropertyDescriptionType
sceneThe main scene. Required only if mouseOverEffect is set to true.THREE.Scene
cameraThe main camera. Required only if mouseOverEffect is set to true.THREE.Camera
mousePosThe current mouse position. Required only if mouseOverEffect is set to true.THREE.Vector2
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.4

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago