You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Sergey74

Intermediate

  • "Sergey74" started this thread

Posts: 171

Location: Russia, Chelyabinsk

Occupation: professional noob

  • Send private message

1

Thursday, April 9th 2020, 10:39am

Another follow mouse example

A simple example of a panorama following a mouse cursor, wrote from nothing to do

https://panosphera.ru/gallery/follow-mouse/

Source code

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
  <layer name="follow_mouse_area"
         type="container"
         keep="true"
         parent="area"
         handcursor="false"
         zorder=""
         capture="false"
         width="100%"
         height="100%"
         bgcapture="true"
         onhover="follow_mouse();"
         onout="follow_mouse_stop();"
         />
  <action name="follow_mouse">
    set(hitx, get(layer[mouse_area].hitx));
    set(hity, get(layer[mouse_area].hity));
    if(hitx GT 0.5, set(value_force_h, calc((hitx - 0.5)*(1))); , set(value_force_h, calc((0.5 - hitx)*(-1))););
    if(hity GT 0.5, set(value_force_v, calc((hity - 0.5)*(1))); , set(value_force_v, calc((0.5 - hity)*(-1))););
    set(hlookat_moveforce, get(value_force_h));
    set(vlookat_moveforce, get(value_force_v));
  </action>
  <action name="follow_mouse_stop">
    set(hlookat_moveforce,0);
    set(vlookat_moveforce,0);
    tween(view.vlookat, 0, 1.5, easeoutback);
  </action>

P.S. As a result, you can get something like this https://panosphera.ru/gallery/copter-model/
translation difficulties *huh*

This post has been edited 1 times, last edit by "Sergey74" (Apr 10th 2020, 5:43am)


Tuur

Sage

Posts: 3,337

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

2

Thursday, April 9th 2020, 11:54am

Nice!
Thanks for sharing!
Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur