Tween plugin to percentage of stage height

  • I have a map image, that I want to scale up (tween) when clicked. But I want to scale to a percentage of the stage height.

    So, something like this:

    Is there any way to accomplish this?

    I've tried:

    Code
    onclick="tween(plugin[map].height, sub(get(stageheight), 10));"

    But that just makes the map disappear when I click it.

    My example is here.

  • Hi,

    i've got similar probem, i want tween my pano area from 100% to 100% -112 (a bottom drawer appear and the pano area go up),

    how i do that ?

    i've tried :

    Code
    <action name="drawer_open">
    	
    	sub(destheight,stageheight, 112); <!-- variable destheight calculated and stored here for later use -->
    	
    	set(area.x, 0, 0.3);
      	set(area.y, 0, 0.3);
      	tween(area.width, 100%, 0.3);
    	tween(area.height, get(destheight), 0.3);
    	</action>

    but the effect is not a shortening from bottom to up, area resize entirely from the top *huh*
    what's wrong here ??

    because when i setup : tween(area.height, 80%, 0.3);
    it works as expecteed, pano aea resize from bottom,so i think i must convert my variable to % ??
    how ?

    Thanks

    Edited 2 times, last by zadda (September 22, 2010 at 8:42 PM).

  • Hi zadda,

    perhaps something like this:

    Note: as area.height could be a number or a percent % as value , there is the area.pixelheight

    Hope this help....

    SAlut.

  • Thanks a lot,
    your code works perfectly *g*

    you rocks !

    the only caveat is when i enter fullscreen, let's say my pano is in a div 800x600, i open the bottom drawer, then the pano resize to the calculated %, but if i enter fullscreen, the height % is a bit different and there an hole beetween the pano bottom and the top drawer...so on fullscreen event i have to setup another action to re-calculate the % height for pano resize :

    but i must add conditional to know if drawwer is on open or close state : ( if stageheight is 100% or already resized....), don't know yet the conditional statement in krpano.....

    Thanks again,i think i 'll need some moe help in futur *g*

  • Hi zadda,

    Quote

    don't know yet the conditional statement in krpano.....


    I think you have to use the onresize event also:

    Hope this help....

    SAlut.

  • Wow,
    Michel you are really an expert, *thumbsup*
    sure you spend many times studying krpano code (ou alors tu as la science infuse *wink* )

    i learn many things with you *g*
    and every time it give me more ideas, krpano is very powerfull

    Thanks again
    (and see u later)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!