krpano 常用action

/ 0评 / 34

1、赋值语句:set({variable},{value})

set (layer[skin_map].visible, true);

2、获取语句:get({variable})

get(layer[skin_map].visible);

3、交替真假:switch({variable})

switch(fullscreen);
switch(hotspot.visible);
switch(layer[button1].visible);

4、交替语句:switch({variable},{valueA},{valueB})

switch(layer[button1].alpha, 1.0, 0.5);
switch(layer[child].parent, button1, button2, button3);

5、补间语句:tween({variable},{destinationvalue},{time}*,{tweentype}*,{donecall}*)
主要将属性改变的过程以动画形式显示,如元素位移和淡入淡出效果

tween(view.vlookat,90.0, 2.0);     //视觉转为向上垂直90度,转换视觉过程为2秒
tween(layer[skin_scroll_layer].y, get(mh), 0.5, easeOutQuint,set(layer[skin_map].visible,false) );
//皮肤滚动条组件Y轴坐标改变到指定位置,转换坐标过程为0.5秒,转换模式为easeOutQuint,转换完成后执行set(layer[skin_map].visible,false)

6、延时调用: delayedcall({delay},{actions})

delayedcall(5.0,hidelogo() );
delayedcall(id1,5.0,hidelogo() ); //id用于其他动作控制该delayedcall
delayedcall(10,looktohotspot(spot1);loadpano(pano2.xml); );

7、变量删除: delete(variable)

set(tmp1, ...);
set(tmp2, ...);
delete(tmp1,tmp2);
delete(layer[skin_scroll_layer].x,layer[skin_scroll_layer].y);

8、变量复制: copy(destination, source)==set(destination,get(source) )

copy(layer[skin_map].height, hh);
set(layer[skin_map].height, 123);

9、判断语句:if({condition}, {then-actions}, {else-actions})

if(show,
   tween(layer[skin_logo].alpha,0.0, 0.25, default,set(layer[skin_logo].visible,false));
   tween(layer[skin_thumbs_container].alpha,0.0, 0.25, default, 
   set(layer[skin_thumbs_container].visible,false));

show为真,执行:tween(layer[skin_logo].alpha,0.0, 0.25, default,set(layer[skin_logo].visible,false));
否则执行:tween(layer[skin_thumbs_container].alpha,0.0, 0.25, default, set(layer[skin_thumbs_container].visible,false));

10、显示文字:showtext({text},{textstyle}*)

onhover="showtext(you are hovering me);" 
onhover="showtext(style text,TEXTSTYLE);" //样式调用
onhover="showtext(line 1[br]line 2[br]line 3);" //分行
onhover="showtext([b]bold[/b] [i]italic[/i]);" //字体

11、动作参数:


copy(layer[radar].x, layer[%1].x);set(layer[radar].heading,%2);

%1:第一个参数,%2:第二个参数,。。。如此类推

参数代入: onclick=”test(abc,100)”
即执行:copy(layer[radar].x,layer[abc].x);set(layer[radar].heading,100);

评论已关闭。