Variable Changed Source Action "Warning Hopki project"

Special forum to share and discuss skins for Pano2VR and Object2VR
Post Reply
User avatar
Hopki
Gnome
Posts: 9271
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Variable Changed Source Action "Warning Hopki project"

Post by Hopki » Thu Dec 20, 2018 4:27 pm

Hi,
This is looking at the Variable Changed source action and what we can do with it.
The source action was originally designed to work with the Animation variable tracks and action filters.
To see this working as intended please see this video: LINK.

The attache project takes this new source action and I'm now using it to trigger events in the skin using the action filter.
So what does the project do...
Well the idea is when you pan the pano between -10 and +10 degrees you get snow.
Outside of this and it stops.

The skin has a true/false variable: start_snow which is set to false to start with.
The skin also has the snow component and as it don't want snow starting I change the line of code in the text box: snow_code:

From: var snowOnLoad = true;
To: var snowOnLoad = false;

This can be found at the top where it says:

// you can modify these...
var snowOnLoad = false;
var snowFlakeCount = 5000;
var snowFlakeSize = 0.006;
var snowFlakeSpeed = 0.0017;


Then to change the variable I added a timer, this starts running using init.
The time out is: 0.100 seconds
And it repeats, toggles.

The timer has the actions:
Activate, Set Variable Value, True, start_snow
Deactivate, Set Variable Value, False, start_snow
So the timer is toggling the variable between true and false.
There is a graphic that changes colour each time the variable changes to you see a visual representation of this.
I also added a text box to display the pan angle.

The timer then has two more actions:
Variable Changed, Go to URL: javascript: startSnow();
And
Variable Changed, Go to URL: javascript: stopSnow();

So as the variable changes the Go to URL actions will be actioned.
To stop the wrong action from being triggered they have Action Filters.

For the action: Variable Changed, Go to URL: javascript: startSnow();
The filter is:
Pan, <=, 10 AND
Pan, >=, -10
So when the variable changes and the pan is between -10 and +10 the snow falls.

For the action: Variable Changed, Go to URL: javascript: stopSnow();
The filter is:
Pan, >, 10 OR
Pan, <, -10
So when the variable changes and the pan is below -10 and above +10 the snow stops.

Have fun,
Hopki
Attachments
variable_changed.zip
(31.69 KiB) Downloaded 27 times

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests