Sie sind nicht angemeldet.

1

Donnerstag, 18. November 2021, 07:17

a little questions about text open/close by one button and animation

HI, I'm new one I create one text hotspot and image hotspot

here is my code

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<hotspot name="f1_content" style="text_hs_sm" type="text" keep="true" alpha="0" enabled="false" visible="false" zorder="5" 
width="0" height="auto" edge="lefttop" mergedalpha="false" oversampling="2" mipmapping="false" 
install_onclick="6" title="f1_content" scene_EL="scene_1" fov_EL="120" enabled2="true" visible2="true" drag_hs="true" bg="true" 
ondown="drag_LinkSM()" html=" test"
/>

<hotspot name="f1" style="link_hs_sm" type="image" keep="true" 
url="open.png" enabled="false" visible="false" zorder="6"
install_onclick="5" title="f1" scene_EL="scene_1" fov_EL="120" enabled2="true" visible2="true" drag_hs="true"	
html='f1'	ondown="drag_LinkSM()"
onclick="js(GetText(get(hotspot[f1_content].name),f1,f2)); "

/>
<hotspot name="f2" style="link_hs_sm" type="image" keep="true"
url="open.png" enabled="false" visible="false" zorder="6"
install_onclick="5" title="f1" scene_EL="scene_1" fov_EL="120" enabled2="true" visible2="true" drag_hs="true"
html='f1' ondown="drag_LinkSM()"
onclick="js(CloseText(f1_content,f2,f1));"

I want to click the open image, and extend the text left to right, then the open image will change to close image. and the close image also can hide the text. I searched many threads still doesn't get it. pls help me.


now did it, but I use two button(two image hotspot) on the same position. and use it to control text spot. I think this is a dumb methed.
still can't control by 1 button

js code like this


Quellcode

1
function GetText(name,open,close){    //let _lang = language.getAttribute('data');    pano.call("tween(hotspot["+ name +"].alpha, 1 ,0.5)");     pano.call("tween(hotspot["+ name +"].height,150,0)");     pano.call("tween(hotspot["+ name +"].width,700,0.4)");     pano.call("set(hotspot["+ name +"].enabled,true)");    pano.call("set(hotspot["+ open +"].visible,false)");    pano.call("set(hotspot["+ open +"].enabled,false)");    pano.call("tween(alpha, 0 ,1)");    pano.call("tween(hotspot["+ close +"].alpha, 1 ,1)");    pano.call("set(hotspot["+ close +"].visible,true)");    pano.call("set(hotspot["+ close +"].enabled,true)");}



Quellcode

1
2
function CloseText(name,close,open){    pano.call("tween(hotspot["+ name +"].alpha, 0 ,0.3)");     pano.call("tween(hotspot["+ name +"].width,0.4)");     pano.call("tween(hotspot["+ name +"].height,0)");     pano.call("set(hotspot["+ name +"].enabled,true)");    pano.call("set(hotspot["+ close +"].visible,false)");    pano.call("set(hotspot["+ close +"].enabled,false)");    pano.call("tween(alpha, 0 ,1)");    pano.call("tween(hotspot["+ open +"].alpha, 1 ,1)");    pano.call("set(hotspot["+ open +"].visible,true)");    pano.call("set(hotspot["+ open +"].enabled,true)");
}




and the animation is so lag, I don't know why?

Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Garman« (18. November 2021, 10:54)


Ähnliche Themen