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:

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

    Code
    <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:


    Code
    <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

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

    Code
    onclick="w_animate(name_of_the_hotspot);"

    and in your action get this name with %1

    Code
    <action name="w_animate">       
    	inc(frame,1,get(hotspot[%1].frames),1);  
            ...
  • Hi Jerombg,

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

    Outside Scene:


    In Scene:

    Einmal editiert, zuletzt von DarManiac (6. November 2017 um 12:32)

  • <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>

  • 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...

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!