|
|
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
<krpano onstart="showtext(Try to resize the browser, infostyle);">
<!-- use only a grid preview pano to save download space ;-) -->
<preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />
<view hlookat="0" fovmin="80" fovmin="50" fovmax="150" maxpixelzoom="off" />
<textstyle name="infostyle"
origin="center" edge="center" textalign="center" background="false" border="false"
fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);"
showtime="5" fadetime="1.0"
/>
<!-- Events where the actions needed to set the area and the border are called -->
<events onresize="define_area_size(500,200,30); set_border()"
onenterfullscreen="reset_area_size();"
onexitfullscreen="back_area_size(); events.onresize();"
/>
<style name="buttonstyle"
url="%SWFPATH%/plugins/textfield.swf" children="false"
width="150" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
visible="false"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<plugin name="set_area" keep="true" style="buttonstyle"
html="[p]set_area[/p]"
align="bottom" x="-120" y="25"
onclick="back_area_size(); events.onresize();"
/>
<plugin name="reset_area" keep="true" style="buttonstyle"
html="[p]reset_area[/p]"
align="bottom" x="120" y="25"
onclick="set(events.onresize,'reset_area_size()'); events.onresize();"
/>
<!-- border -->
<plugin name="border_top" url="border_x2.png" enabled="false" align="lefttop" edge="lefttop" />
<plugin name="border_bottom" url="border_x2.png" enabled="false" align="leftbottom" edge="leftbottom" />
<plugin name="border_left" url="border_x2.png" enabled="false" align="lefttop" edge="lefttop" />
<plugin name="border_right" url="border_x2.png" enabled="false" align="righttop" edge="righttop" />
<!-- action to set the border of the area -->
<action name="set_border">
set(plugin[border_top].width,get(area.width));
set(plugin[border_bottom].width,get(area.width));
set(plugin[border_left].height,get(area.height));
set(plugin[border_right].height,get(area.height));
</action>
<!-- actions to set the area -->
<!-- Example of use: -->
<!-- define_area_size(500,200,30); -->
<!-- there is 3 parameters: -->
<!-- %1 = image width -- ex: 500 -->
<!-- %2 = image height -- ex: 200 -->
<!-- %3 = margin -- ex: 30 -->
<action name="define_area_size">
trace(%1_%2_%3);
div(aspect,%1,%2);
set(dest_area_x,%3);
mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val));
div(dest_area_height,dest_area_width,aspect);
sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2);
if(dest_area_y LT dest_area_x, set(dest_area_y,%3);
mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val));
mul(dest_area_width,dest_area_height,aspect);
sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2);
set_area_size(); , set_area_size(); );
</action>
<!-- actions to set the area -->
<action name="set_area_size">
copy(area.x, dest_area_x);
copy(area.y, dest_area_y);
copy(area.width, dest_area_width);
copy(area.height, dest_area_height);
</action>
<!-- actions to reset the area -->
<action name="reset_area_size">
set(area.x, 0);
set(area.y, 0);
set(area.width, get(stagewidth));
set(area.height, get(stageheight));
set(plugin[border_top].visible,false);
set(plugin[border_bottom].visible,false);
set(plugin[border_left].visible,false);
set(plugin[border_right].visible,false);
</action>
<action name="back_area_size">
set(events.onresize,'define_area_size(500,200,30); set_border()');
set(plugin[border_top].visible,true);
set(plugin[border_bottom].visible,true);
set(plugin[border_left].visible,true);
set(plugin[border_right].visible,true);
</action>
</krpano>
|
|
|
Quellcode |
1 |
<area x="0%" y="0%" width="100%" height="100%" /> |
|
|
Quellcode |
1 2 3 4 5 6 |
<action name="resetarea"> set(area.x, 0%); set(area.y, 0%); set(area.width, 100%); set(area.height, 100%); </action> |
|
|
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
<krpano onstart="showtext(Try to resize the browser, infostyle);">
<!-- use only a grid preview pano to save download space ;-) -->
<preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />
<view hlookat="-15" vlookat="-10" fov="80" fovmin="50" fovmax="150" maxpixelzoom="off" />
<textstyle name="infostyle"
origin="center" edge="center" textalign="center" background="false" border="false"
fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);"
showtime="5" fadetime="1.0"
/>
<!-- Events where the actions needed to set the area and the border are called -->
<events onresize="set_area_size();"
onenterfullscreen="reset_area_size();"
onexitfullscreen="set_area_size();"
/>
<style name="buttonstyle" url="%SWFPATH%/plugins/textfield.swf" children="false"
visible="false" width="150" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<plugin name="set_area" keep="true" style="buttonstyle"
html="[p]set_area[/p]"
align="bottom" x="-170" y="25"
onclick="set_area_size();"
/>
<plugin name="reset_area" keep="true" style="buttonstyle"
html="[p]reset_area[/p]"
align="bottom" x="0" y="25"
onclick="reset_area_size();"
/>
<plugin name="border" keep="true" style="buttonstyle"
html="[p]set border[/p]"
align="bottom" x="170" y="25"
onclickBorderFalse="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
onclickBorderTrue="set(area_vars.border.value,true); set_border(); set(plugin[border].onclick,get(onclickBorderFalse)); set(plugin[border].html,'[p]border = true[/p]');"
onclick="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
/>
<!-- area border -->
<plugin name="border_top" url="border_x2.png" visible="false" enabled="false" align="lefttop" edge="lefttop" />
<plugin name="border_bottom" url="border_x2.png" visible="false" enabled="false" align="leftbottom" edge="leftbottom" />
<plugin name="border_left" url="border_x2.png" visible="false" enabled="false" align="lefttop" edge="lefttop" />
<plugin name="border_right" url="border_x2.png" visible="false" enabled="false" align="righttop" edge="righttop" />
<!-- define variables to set the area -->
<area_vars>
<image_width value="500" />
<image_height value="200" />
<margin value="30" />
<border value="true" />
</area_vars>
<!-- actions to set the area -->
<action name="set_area_size">
set(events.onresize,'set_area_size();');
div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value));
set(dest_area_x,get(area_vars.margin.value));
mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val));
div(dest_area_height,dest_area_width,aspect);
sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2);
if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value));
mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val));
mul(dest_area_width,dest_area_height,aspect);
sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , );
copy(area.x, dest_area_x);
copy(area.y, dest_area_y);
copy(area.width, dest_area_width);
copy(area.height, dest_area_height);
if( area_vars.border.value == true, set_border(););
</action>
<!-- actions to reset the area -->
<action name="reset_area_size">
set(events.onresize,);
set(area.x, 0%);
set(area.y, 0%);
set(area.width, 100%);
set(area.height, 100%);
reset_border();
</action>
<!-- action to set the area border -->
<action name="set_border">
set(plugin[border_top].width,get(area.width));
set(plugin[border_bottom].width,get(area.width));
set(plugin[border_left].height,get(area.height));
set(plugin[border_right].height,get(area.height));
set(plugin[border_top].visible,true);
set(plugin[border_bottom].visible,true);
set(plugin[border_left].visible,true);
set(plugin[border_right].visible,true);
</action>
<!-- action to reset the area border -->
<action name="reset_border">
set(plugin[border_top].visible,false);
set(plugin[border_bottom].visible,false);
set(plugin[border_left].visible,false);
set(plugin[border_right].visible,false);
</action>
</krpano>
|
|
|
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
<krpano onstart="showtext(Try to resize the browser, infostyle);">
<!-- use only a grid preview pano to save download space ;-) -->
<preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />
<view hlookat="-15" vlookat="-10" fov="80" fovmin="50" fovmax="150" maxpixelzoom="off" />
<textstyle name="infostyle"
origin="center" edge="center" textalign="center" background="false" border="false"
fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);"
showtime="5" fadetime="1.0"
/>
<!-- Events where the actions needed to set the area and the border are called -->
<events onresize="set_area_size();"
onenterfullscreen="reset_area_size();"
onexitfullscreen="set_area_size();"
/>
<style name="buttonstyle" url="%SWFPATH%/plugins/textfield.swf" children="false"
visible="false" width="150" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<plugin name="set_area" keep="true" style="buttonstyle"
html="[p]set_area[/p]"
align="bottom" x="-170" y="25"
onclick="set_area_size();"
/>
<plugin name="reset_area" keep="true" style="buttonstyle"
html="[p]reset_area[/p]"
align="bottom" x="0" y="25"
onclick="reset_area_size();"
/>
<plugin name="border" keep="true" style="buttonstyle"
html="[p]set border[/p]"
align="bottom" x="170" y="25"
onclickBorderFalse="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
onclickBorderTrue="set(area_vars.border.value,true); set_border(); set(plugin[border].onclick,get(onclickBorderFalse)); set(plugin[border].html,'[p]border = true[/p]');"
onclick="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
/>
<!-- area border -->
<plugin name="border_top" url="border_x2.png" enabled="false" align="top" width="100%" accuracy="1" />
<plugin name="border_bottom" url="border_x2.png" enabled="false" align="bottom" width="100%" accuracy="1" />
<plugin name="border_left" url="border_x2.png" enabled="false" align="left" height="100%" accuracy="1" />
<plugin name="border_right" url="border_x2.png" enabled="false" align="right" height="100%" accuracy="1" />
<!-- define variables to set the area -->
<area_vars>
<image_width value="500" />
<image_height value="200" />
<margin value="30" />
<border value="true" />
</area_vars>
<!-- actions to set the area -->
<action name="set_area_size">
set(events.onresize,'set_area_size();');
div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value));
set(dest_area_x,get(area_vars.margin.value));
mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val));
div(dest_area_height,dest_area_width,aspect);
sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2);
if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value));
mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val));
mul(dest_area_width,dest_area_height,aspect);
sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , );
copy(area.x, dest_area_x);
copy(area.y, dest_area_y);
copy(area.width, dest_area_width);
copy(area.height, dest_area_height);
if( area_vars.border.value == true, set_border(););
</action>
<!-- actions to reset the area -->
<action name="reset_area_size">
set(events.onresize,);
set(area.x, 0%);
set(area.y, 0%);
set(area.width, 100%);
set(area.height, 100%);
if( area_vars.border.value == false, reset_border(););
</action>
<!-- action to set the area border -->
<action name="set_border">
set(plugin[border_top].visible,true);
set(plugin[border_bottom].visible,true);
set(plugin[border_left].visible,true);
set(plugin[border_right].visible,true);
</action>
<!-- action to reset the area border -->
<action name="reset_border">
set(plugin[border_top].visible,false);
set(plugin[border_bottom].visible,false);
set(plugin[border_left].visible,false);
set(plugin[border_right].visible,false);
</action>
</krpano>
|
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
<action name="reset_and tween_area_size"> set(events.onresize,); set(area.x, 0%); set(area.y, 0%); tween(area.width, 100%); tween(area.height, 100%); if( area_vars.border.value == false, reset_border();); </action> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<!-- tweening actions to reset the area --> <action name="reset_and tween_area_size"> set(events.onresize,); tween(area.x, 0); tween(area.y, 0); tween(area.width, get(stagewidth)); tween(area.height, get(stageheight),,,WAIT); set(area.x, 0%); set(area.y, 0%); set(area.width, 100%); set(area.height, 100%); if( area_vars.border.value == false, reset_border();); </action> |
WAIT flag for the tween() action
- waiting until this tween has been finished before the next action command will be executed
- usage:
![]()
Quellcode
1 tween(variable,destinationvalue,time,tweentype,WAIT);
So, without the WAIT flag, the following actions are executed (the set(area.x, 0%),ect...)... this is why the "tour" shakes a little and starts tweeningThe tween() action starts only a 'process' to change a value during the time, but after starting it, the next action will be processed, this allows the tween() several values at once,...
...Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »michel« (15. Mai 2010, 14:02)
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<!-- tweening actions to set the area --> <action name="set_area_size_tween"> set(events.onresize,'set_area_size();'); div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value)); set(dest_area_x,get(area_vars.margin.value)); mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val)); div(dest_area_height,dest_area_width,aspect); sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2); if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value)); mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val)); mul(dest_area_width,dest_area_height,aspect); sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , ); set(area.x, 0); set(area.y, 0); set(area.width, get(stagewidth)); set(area.height, get(stageheight)); tween(area.x, get(dest_area_x)); tween(area.y, get(dest_area_y)); tween(area.width, get(dest_area_width)); tween(area.height, get(dest_area_height),,,WAIT); if( area_vars.border.value == true, set_border();); </action> |
.|
|
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 35 36 |
<!-- actions to set the area --> <action name="area_size"> div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value)); set(dest_area_x,get(area_vars.margin.value)); mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val)); div(dest_area_height,dest_area_width,aspect); sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2); if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value)); mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val)); mul(dest_area_width,dest_area_height,aspect); sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , ); </action> <action name="set_area_size"> area_size(); set(events.onresize,'set_area_size();'); copy(area.x, dest_area_x); copy(area.y, dest_area_y); copy(area.width, dest_area_width); copy(area.height, dest_area_height); if( area_vars.border.value == true, set_border();); </action> <action name="tween_area_size"> area_size(); set(events.onresize,'set_area_size();'); set(area.x, 0); set(area.y, 0); set(area.width, get(stagewidth)); set(area.height, get(stageheight)); tween(area.x, get(dest_area_x)); tween(area.y, get(dest_area_y)); tween(area.width, get(dest_area_width)); tween(area.height, get(dest_area_height),,,WAIT); if( area_vars.border.value == true, set_border();); </action> |
I have tried this code but the area keeps resizing all the time, like in an infinite loop. Why is this happening?Hi Astroman,
Answering to your private message (*), here a modified code to set the area size using tween :
![]()
Quellcode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 <!-- tweening actions to set the area --> <action name="set_area_size_tween"> set(events.onresize,'set_area_size();'); div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value)); set(dest_area_x,get(area_vars.margin.value)); mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val)); div(dest_area_height,dest_area_width,aspect); sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2); if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value)); mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val)); mul(dest_area_width,dest_area_height,aspect); sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , ); set(area.x, 0); set(area.y, 0); set(area.width, get(stagewidth)); set(area.height, get(stageheight)); tween(area.x, get(dest_area_x)); tween(area.y, get(dest_area_y)); tween(area.width, get(dest_area_width)); tween(area.height, get(dest_area_height),,,WAIT); if( area_vars.border.value == true, set_border();); </action>
(*) hope it can be usefull to other also.
SAlut.
|
|
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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
<krpano onstart="showtext(Try to resize the browser, infostyle);">
<!-- use only a grid preview pano to save download space ;-) -->
<preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />
<view hlookat="-15" vlookat="-10" fov="80" fovmin="50" fovmax="150" maxpixelzoom="off" />
<textstyle name="infostyle"
origin="center" edge="center" textalign="center" background="false" border="false"
fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);"
showtime="5" fadetime="1.0"
/>
<!-- Events where the actions needed to set the area and the border are called -->
<events onresize="set_area_size();"
onenterfullscreen="reset_area_size();"
onexitfullscreen="set_area_size();"
/>
<style name="buttonstyle" url="%SWFPATH%/plugins/textfield.swf" children="false"
visible="false" width="150" height="22"
css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }"
backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF"
onover="tween(alpha,0.7,distance(0.3,0.2));"
onout="tween(alpha,1.0,distance(0.3,0.2));"
onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
/>
<plugin name="set_area" keep="true" style="buttonstyle"
html="[p]set_area[/p]"
align="bottom" x="-170" y="25"
onclick="set_area_size();"
/>
<plugin name="reset_area" keep="true" style="buttonstyle"
html="[p]reset_area[/p]"
align="bottom" x="0" y="25"
onclick="reset_area_size();"
/>
<plugin name="border" keep="true" style="buttonstyle"
html="[p]set border[/p]"
align="bottom" x="170" y="25"
onclickBorderFalse="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
onclickBorderTrue="set(area_vars.border.value,true); set_border(); set(plugin[border].onclick,get(onclickBorderFalse)); set(plugin[border].html,'[p]border = true[/p]');"
onclick="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
/>
<!-- area border -->
<plugin name="border_top" url="border_x2.png" enabled="false" align="top" width="100%" accuracy="1" />
<plugin name="border_bottom" url="border_x2.png" enabled="false" align="bottom" width="100%" accuracy="1" />
<plugin name="border_left" url="border_x2.png" enabled="false" align="left" height="100%" accuracy="1" />
<plugin name="border_right" url="border_x2.png" enabled="false" align="right" height="100%" accuracy="1" />
<!-- define variables to set the area -->
<area_vars>
<image_width value="500" />
<image_height value="200" />
<margin value="30" />
<border value="true" />
</area_vars>
<!-- actions to set the area -->
<action name="set_area_size">
set(events.onresize,'set_area_size();');
div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value));
set(dest_area_x,get(area_vars.margin.value));
mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val));
div(dest_area_height,dest_area_width,aspect);
sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2);
if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value));
mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val));
mul(dest_area_width,dest_area_height,aspect);
sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , );
set(area.x, 0);
set(area.y, 0);
set(area.width, get(stagewidth));
set(area.height, get(stageheight));
tween(area.x, get(dest_area_x));
tween(area.y, get(dest_area_y));
tween(area.width, get(dest_area_width));
tween(area.height, get(dest_area_height),,,WAIT);
if( area_vars.border.value == true, set_border(););
</action>
<action name="reset_area_size">
set(events.onresize,);
tween(area.x, 0);
tween(area.y, 0);
tween(area.width, get(stagewidth));
tween(area.height, get(stageheight),,,WAIT);
set(area.x, 0%);
set(area.y, 0%);
set(area.width, 100%);
set(area.height, 100%);
if( area_vars.border.value == false, reset_border(););
</action>
<!-- action to set the area border -->
<action name="set_border">
set(plugin[border_top].visible,true);
set(plugin[border_bottom].visible,true);
set(plugin[border_left].visible,true);
set(plugin[border_right].visible,true);
</action>
<!-- action to reset the area border -->
<action name="reset_border">
set(plugin[border_top].visible,false);
set(plugin[border_bottom].visible,false);
set(plugin[border_left].visible,false);
set(plugin[border_right].visible,false);
</action>
</krpano>
|


