krpano 教程 - 常用actions說明



賦值語句:set({variable},{value})

獲取語句:get({variable})

交替真假:switch({variable})

交替語句:switch({variable},{valueA},{valueB})

補間語句:tween({variable},{destinationvalue},{time}*,{tweentype}*,{donecall}*)

延時調用: delayedcall({delay},{actions})

變量刪除: delete(variable)

變量複製: copy(destination, source)==set(destination,get(source) )

判斷語句:if({condition}, {then-actions}, {else-actions})

顯示文字showtext({text},{textstyle}*)

動作參數:copy(layer[radar].x,layer[%1].x);set(layer[radar].heading, %2);

 

  

舉例說明:

 

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動作參數:

<action name=”test”>

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

</action>

 

%1:第一個參數,%2:第二個參數,。。。如此類推

 

參數代入: οnclick=”test(abc,100)”

 

即執行:copy(layer[radar].x,layer[abc].x);set(layer[radar].heading,100);



免費全景教程資料下載:http://krpano.cc/teach



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章