Sie sind nicht angemeldet.

1

Dienstag, 3. Mai 2022, 16:43

action for 27 hotspots

I photographed a kitchen in such a way that you can open and close the individual kitchen boxes in the panorama.
I did the whole thing with the add hostpot plugin from novosibpano.
Many thanks for your great work!

But now to my problem, as I said, everything works wonderfully.
I think it's just too much work for the code I have to write for it.

I had to write the code below (in abbreviated form) for all 27 hotspots needed.
I think that's too much.

I would like to write an action that sets all kitchen hotspots to alpha 0 as soon as one is clicked.
Only selected ones shall remain active on alpha 1.
with such an action I write the whole thing only once and one line for each hotspot.

I'm sure it works, but I don't know how.
I'm a photographer myself, not a programmer, so I hope you can help me with that.

Below is the code as I am currently writing it.
As I said, it works so wonderfully.
But it may not be the right way if you want to learn a bit of programming....

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<hotspot name="hs_polig_2" style="pl_hs_add_hs" fillalpha="0" borderalpha="0" zorder="6"
 		  title="0" scene_EL="scene_start" fillalpha2="0" borderalpha2="0"
 		  onclick="if(hotspot[hotspot_2].alpha === 0, tween(hotspot[hotspot_2].alpha,1),tween(hotspot[hotspot_2].alpha,0));
                   if(hotspot[hotspot_1].alpha === 1, tween(hotspot[hotspot_1].alpha,0),tween(hotspot[hotspot_1].alpha,0));
                   if(hotspot[hotspot_3].alpha === 1, tween(hotspot[hotspot_3].alpha,0),tween(hotspot[hotspot_3].alpha,0));
                   if(hotspot[hotspot_4].alpha === 1, tween(hotspot[hotspot_4].alpha,0),tween(hotspot[hotspot_4].alpha,0));"
		>
 		  <point ath="-76.077" atv="-22.341" />
 		  <point ath="-54.019" atv="-22.909" />
 		  <point ath="-54.215" atv="-33.662" />
 		  <point ath="-76.311" atv="-33.001" />
 </hotspot>

 <hotspot name="hs_polig_1" style="pl_hs_add_hs" fillalpha="0" borderalpha="0" zorder="6"
 		  title="hs_polig_1" scene_EL="scene_start" fillalpha2="0" borderalpha2="0"
 		  onclick="if(hotspot[hotspot_1].alpha === 0, tween(hotspot[hotspot_1].alpha,1),tween(hotspot[hotspot_1].alpha,0));
                   if(hotspot[hotspot_2].alpha === 1, tween(hotspot[hotspot_2].alpha,0),tween(hotspot[hotspot_2].alpha,0));
                   if(hotspot[hotspot_3].alpha === 1, tween(hotspot[hotspot_3].alpha,0),tween(hotspot[hotspot_3].alpha,0));
                   if(hotspot[hotspot_4].alpha === 1, tween(hotspot[hotspot_4].alpha,0),tween(hotspot[hotspot_4].alpha,0));"
		>
 		  <point ath="-93.276" atv="-19.388" />
 		  <point ath="-77.264" atv="-21.957" />
 		  <point ath="-77.475" atv="-33.086" />
 		  <point ath="-93.443" atv="-29.823" />
 </hotspot>

toosten

Fortgeschrittener

Beiträge: 521

Wohnort: Berlin

Beruf: Software-Entwickler bei VR-Easy ( HTML, JS, PHP, krpano, C++, Java )

  • Nachricht senden

2

Mittwoch, 4. Mai 2022, 17:35

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<action name="openHS">
	for( set(i, 0), i LT hotspot.count, inc(i),
		if( hotspot[get(i)].style == 'pl_hs_add_hs',
			if( hotspot[get(i)].name == hotspot[%1],
				set( hotspot[%1].alpha, 1);
			,
				set( hotspot[get(i)].alpha, 0);
		);
	);
</action>

<hotspot name="hs_polig_2" style="pl_hs_add_hs" fillalpha="0" borderalpha="0" zorder="6"
 		  title="0" scene_EL="scene_start" fillalpha2="0" borderalpha2="0"
 		  onclick="openHS( get(name))" ...