Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Samstag, 4. November 2017, 10:57

How to start an animation action on a hotspot sprite sheet from another hotspot ?

Hi,

These forums are very helpful. I believe, I have never been stuck on a krpano project and not found an answer here. Krpano itself is a genius piece of software and with the best help in this forum.

My question today is I have a sprite sheet that I am animating on a hotspot, which works fine:

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
26
27
28
29
30
31
32
33
34
    <style name="w_style"              
	url="skin/asst1b.png"                
	crop="0|0|77|153"              
	frames="7" framewidth="77" frameheight="153" frame="1" loopNo="19" loopCount="0"                
	column="1" columns="7" columnframenr="1"   
	onloaded=""                         
	altonloaded="if(isphone, mul(scale,2)); onloaded();"                
	scale="1.5"             
	edge=""             
	oy="0"              
	onclick="w_animate();"              
	distorted="true" 
    />



<action name="w_animate">       
	inc(frame,1,get(frames),1);         
	mul(t, column, columnframenr);      
	add(t,1);       
	if(frame == t, inc(column,1));  
	sub(xp, column,1);          
	mul(xp, framewidth);            
	mul(yp,frame,frameheight);          
	mul(ch, columnframenr, frameheight);            
	sub(cm, column,1);          
	sub(q,columns,1);       
	mul(ce, ch,cm);
	if(cm==q, set(column, 1));  
	if(yp GT ch, sub(yp, ce));          
	sub(yp, frameheight);                       
	txtadd(crop, get(xp),'|',get(yp),'|',get(framewidth),'|',get(frameheight));
	if(loopCount LE loopNo, inc(loopCount, 1);  delayedcall(0.08, w_animate() ); , set(loopCount, 0); );
</action>


Now when I am calling the hotspot in a scene it works fine too.

Quellcode

1
2
3
4
5
6
7
8
9
	 <scene name="" title="" onstart="" thumburl="" lat="" lng="" heading="">
	.
	.	.	.
	<hotspot name="asst_cursor" 
	style="w_style"
	ath="61.016" atv="-5.7"
	enabled="true"
	onclick="w_animate();"
	/>



But what I want is to call the animation on that hotspot after clicking on another hotspot and I cannot get my head around how to do that ... *wacko*
This part below is the problem:


Quellcode

1
2
	<hotspot name="spotOpt1" url="skin/buttons_yellow.png" distorted="true" scale="0.25" enabled="true" ath="45.382" atv="-0.911" 
					onclick="set(hotspot[asst_cursor].w_animate(); );" />



Thanks,
DarManiac



Beiträge: 679

Wohnort: Angers - France

Beruf: Photographer

  • Nachricht senden

2

Sonntag, 5. November 2017, 17:31

call the action with the name of the hotspot you want to animate :

Quellcode

1
onclick="w_animate(name_of_the_hotspot);"


and in your action get this name with %1

Quellcode

1
2
3
<action name="w_animate">       
	inc(frame,1,get(hotspot[%1].frames),1);  
        ...

3

Montag, 6. November 2017, 11:38

Hi Jerombg,

Thanks. I tried your suggestion but it doesn't seem to be working. Did I do something wrong... ??

Outside Scene:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
    <style name="w_style" 
        url="skin/asst1b.png" 
        crop="0|0|77|153" 
        frames="7" framewidth="77" frameheight="153" frame="1" loopNo="19" loopCount="0" 
        column="1" columns="7" columnframenr="1" 
        onloaded="" 
        altonloaded="if(isphone, mul(scale,2)); onloaded();" 
        scale="1.5" 
        edge="" 
        oy="0" 
        onclick="w_animate();" 
        distorted="true" 
    />



In Scene:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<hotspot name="spotOpt3" url="skin/buttons_yellow.png" distorted="true" scale="0.25" enabled="true" ath="45.382" atv="-16.911" 
                                                                                    onclick="w_animate1(asst_cursor);" />

    <action name="w_animate1"> 
        inc(get(hotspot[%1].frame),1,get(hotspot[%1].frames),1); 
        mul(t, get(hotspot[%1].column), get(hotspot[%1].columnframenr)); 
        add(t,1); 
        if(get(hotspot[%1].frame) == t, inc(get(hotspot[%1].column,1))); 
        sub(xp, get(hotspot[%1].column),1); 
        mul(xp, get(hotspot[%1].framewidth)); 
        mul(yp, get(hotspot[%1].frame), get(hotspot[%1].frameheight)); 
        mul(ch, get(hotspot[%1].columnframenr), get(hotspot[%1].frameheight)); 
        sub(cm, get(hotspot[%1].column),1); 
        sub(q, get(hotspot[%1].columns),1); 
        mul(ce, ch,cm);
        if(cm==q, set(get(hotspot[%1].column), 1)); 
        if(yp GT ch, sub(yp, ce)); 
        sub(yp, get(hotspot[%1].frameheight)); 
        txtadd(crop, get(xp),'|',get(yp),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
        if(get(hotspot[%1].loopCount) LE get(hotspot[%1].loopNo), inc(get(hotspot[%1].loopCount), 1);  delayedcall(0.08, w_animate(asst_cursor) ); , set(get(hotspot[%1].loopCount), 0); );
    </action>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »DarManiac« (6. November 2017, 12:32)


Beiträge: 679

Wohnort: Angers - France

Beruf: Photographer

  • Nachricht senden

4

Montag, 6. November 2017, 13:35

what is the code of your asst_cursor hotspot ?

5

Montag, 6. November 2017, 13:42

Quellcode

1
2
3
4
5
<hotspot name="asst_cursor" 
            style="w_style"
            ath="61.016" atv="-5.7"
            enabled="true"
         />

Beiträge: 679

Wohnort: Angers - France

Beruf: Photographer

  • Nachricht senden

6

Montag, 6. November 2017, 13:56

<action name="w_animate1">
inc(get(hotspot[%1].frame),1,get(hotspot[%1].frames),1);
mul(t, get(hotspot[%1].column), get(hotspot[%1].columnframenr));
add(t,1);
if(get(hotspot[%1].frame) == t, inc(get(hotspot[%1].column,1)));
sub(xp, get(hotspot[%1].column),1);
mul(xp, get(hotspot[%1].framewidth));
mul(yp, get(hotspot[%1].frame), get(hotspot[%1].frameheight));
mul(ch, get(hotspot[%1].columnframenr), get(hotspot[%1].frameheight));
sub(cm, get(hotspot[%1].column),1);
sub(q, get(hotspot[%1].columns),1);
mul(ce, ch,cm);
if(cm==q, set(get(hotspot[%1].column), 1));
if(yp GT ch, sub(yp, ce));
sub(yp, get(hotspot[%1].frameheight));
txtadd(crop, get(xp),'|',get(yp),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
if(get(hotspot[%1].loopCount) LE get(hotspot[%1].loopNo), inc(get(hotspot[%1].loopCount), 1); delayedcall(0.08, w_animate(asst_cursor) ); , set(get(hotspot[%1].loopCount), 0); );
</action>

should be

<action name="w_animate1">
inc(get(hotspot[%1].frame),1,get(hotspot[%1].frames),1);
mul(t, get(hotspot[%1].column), get(hotspot[%1].columnframenr));
add(t,1);
if(get(hotspot[%1].frame) == t, inc(get(hotspot[%1].column,1)));
sub(xp, get(hotspot[%1].column),1);
mul(xp, get(hotspot[%1].framewidth));
mul(yp, get(hotspot[%1].frame), get(hotspot[%1].frameheight));
mul(ch, get(hotspot[%1].columnframenr), get(hotspot[%1].frameheight));
sub(cm, get(hotspot[%1].column),1);
sub(q, get(hotspot[%1].columns),1);
mul(ce, ch,cm);
if(cm==q, set(get(hotspot[%1].column), 1));
if(yp GT ch, sub(yp, ce));
sub(yp, get(hotspot[%1].frameheight));
txtadd(crop, get(xp),'|',get(yp),'|',get(hotspot[%1].framewidth),'|',get(hotspot[%1].frameheight));
if(get(hotspot[%1].loopCount) LE get(hotspot[%1].loopNo), inc(get(hotspot[%1].loopCount), 1); delayedcall(0.08, w_animate1(asst_cursor) ); , set(get(hotspot[%1].loopCount), 0); );
</action>

7

Montag, 6. November 2017, 14:04

Thanks so much for the prompt response

I see w_animate1 error that i made. I still copied that entire block you gave just to be sure.

I tested it and what is happening is that the button I am clicking is getting cropped, but the other hotspot isn't getting animated...

Beiträge: 679

Wohnort: Angers - France

Beruf: Photographer

  • Nachricht senden

8

Mittwoch, 8. November 2017, 10:43

why not just calling the hotspot onclick action then, something like :
<hotspot name="spotOpt3" onclick="callwith(hotspot[asst_cursor],onclick())"/>

9

Mittwoch, 8. November 2017, 14:21

Thanks Jerome ... You're brilliant.. It works... *smile* Thank you so much ... was whacking my head over this. I did not know how to use call with function...

Thanks,
DarManiac