0
Answered

Snapshot autostart

diane.simard 3 weeks ago updated 5 days ago 15

Hi, i'm trying to animate a zoom in at start of my scene.  I can animate that with snapshot but it need to be triggered to work.  Is there any way to autostart a snapshot?

Answered

Sure, you can do this with some javascript code. See here for more details on manual snapshot control: https://boxshot.com/koru/tutorials/tips/manual-snapshots-control/

ok but i'm not familiar with coding and this example is not solving to my problem.  So what would be the code to make autostart a zoomed out view of a scene?

Unfortunately, you need to be familiar with coding in order to auto-start the snapshot :( Try reproducing the steps at the link above and when it works on your side, replace the koruInit() function with this:

function koruInit(koru) {
    activate("PresetNameHere");
}

replacing the PresetNameHere with the actual name of the preset you want to run.

I tried it.  not working.  here is what it looks like

function koruInit(koru) {
activate("btn-far");

}
function activate(what) {
var el = document.getElementsByClassName("koru-viewport")[0];
var koru = el.koru;
for (var i in koru.snapshots) {
var snapshot = koru.snapshots[i];
if (snapshot.name == what) {
snapshot.apply();
break;
}
}
}

Does the original code from the tutorial work for you? If yes, are there any errors in the browser console?

yes i did the tuto and it's working but  if I try the code above to autostart it does nothing.

Is it available online somewhere? I'd like to have a look.

here sis the test scene and the html  https://www.dropbox.com/t/P47LmkYgrZmL9eiO

Ultimately I want to execute a zoom in for the start of this project.  https://koru.boxshot.com/scenes/a0f5b49cbbf847988092

Thanks for the sample. My bad, in koruInit() the scene is not yet ready. Try this:

function koruInit(koru) {
    koru.addEventListener('loadend', onLoadEnd);
}

function onLoadEnd() {
    activate("Far");
}

I've just checked it with your scene and it works just fine.

Yes it's working!!!  Thanks a lot.

One last question...  I use a snippet camera rotation in the script editor also.  But now the zoom in is working the rotation is no longer there.  Do you have an idea of what is happening?

Hi did you get my message?

It is hard to help without seeing the updated project. Please upload the new version somewhere, so I can have another look. So far I can't even understand what the "rotation is no longer there" means. Sorry.

ok .  When I build my scene, I use the script editor to add a autorotation to the camera after a while.  You can do it by using the snippets (image attached)  When I export my scene using the template mini fullscreen, it's working well.

But since I modified the template to add a zoom in code (what you gave me) Now when I export my scene, the rotation snippet is not applied and the scene only makes a zoom in and that's all.  How can I make the rotation working with the zoom in template?  Here is the scene working with the zoom in code: https://horizongrafik.com/carte/testing.html

I hope it's more clear :)

Unfortunately, the page gives a 404 error. The problem could be caused by the javascript code, which should look like this:

function koruInit(koru) {
    koru.addEventListener('loadend', onLoadEnd);
    koru.addEventListener('update', onKoruUpdate);
}

function onLoadEnd() {
    activate("Far");
}

function onKoruUpdate() {
    // the code from the screenshot above
}

So you need to add two handlers in a single koruInit() and implement them in two separate functions.

Thanks,  everything is fine nom!

May I suggest for next version of the sofware to add a rollover option for the callouts?  That would be awsome.

Great app and good support!