When a loadImage() function?


#1

When will be implemented a loadImage() function similar to the loadSound() already available?


#2

Hi Mario,

at the moment there is no API for that. Can you please explain what exactly do you want to do so we can better understand.

For example, the loadSound() method returns a Sound object to control an audio clip using methods like play() and pause(). What would you like to have for an Image object?

Thank you!


#3

Hi Benny,

what about switching on the fly environment 360 photos, for example if an event triggers,
or pictures on a billboard for a slideshow within the 3d space (like a virtual classroom…)?
Images could be uploaded from the code

Thank you!

.mario


#4

Thank you for the feedback.

We have an internal API for changing 360 images but there are some problems which need to be solved. We’re working on it.

You can already use the existing APIs to create slideshows etc. by manipulating images which are already in the scene. Have a look at this example: https://cospac.es/zdhY

Here is the code used in the example:

const images = [
    Scene.getItem('img1'),
    Scene.getItem('img2'),
    Scene.getItem('img3'),
    Scene.getItem('img4'),
    Scene.getItem('img5')
];

images.forEach((img) => {
    img.setScale(0.001);
});

const wom = Scene.getItem('wom');
wom.say('Click on me to display different images.');

let i = 0;
let imgNum = images.length;
wom.onActivate(() => {
    images.forEach((img) => {
        img.setScale(0.001);
    });
    images[i % imgNum].setScale(1);
    i++;
});

You can manipulate images in many ways. Move, scale and rotate them to create the effects you wish.