t3d-pano
Panorama extension for t3d.
Demo
Getting Started
Create pano:
const pano = new Pano();
scene.add(pano);
pano.visible = true;
pano.material.diffuseMap = texture;
pano.material.opacity = 1;
pano.material.uniforms.stretchFactor = 0;
pano.renderOrder = 0;
Establish link relationships for panos:
const graph = new PanoGraph();
graph.link(pano1, pano2, direction);
graph.link(pano2, pano1, direction);
graph.delink(pano2, pano1);
const links = graph.getLinks(pano1);
Use Pano Switcher to switch panos by link info and options:
const switcher = new FadeSwitcher();
switcher.run(link, options);
switcher.update(deltaTime);
Use sample:
function showPano(pano) {
const links = graph.getLinks(pano1);
links.forEach(link => {
const sprite = new Sprite();
sprite.position.copy(link.dirction).multiplyScalar(100);
sprite.addEventListener('click', () => {
switcher.run(link, { time: 500 }).onUpdate((link, elapsed) => {})
.onComplete((link) => {});
});
});
}
How to create CustomSwitcher:
class CustomSwitcher extends PanoSwitcher {
constructor() {
super();
}
_resetProperties() {
}
_updateProperties(elapsed) {
}
}