When building a skin, sometimes you need a little more control over how elements react to user input or other events. Logic Blocks will, for example, allow you to target a specific element to scale to a specific size depending on the player's width, creating a responsive skin.
Logic blocks are a way of automatically altering values of skin elements, making it possible to react to certain circumstances – using logic. These value changes can be activated by a wide range of triggers, from window size to user interactions, events from the panorama player, and much more.
Logic blocks can be applied to any skin element. Element properties that can have logic blocks will have an arrow button next to their name in the properties panel. If the element has a logic block applied the arrow will be orange, otherwise it is gray. To add a logic block, just click the gray arrow.
A logic block consists of expressions. Each expression consists of conditions. You can have multiple expressions in a logic block and you can have multiple conditions in an expression.
A condition consists of a Trigger, Comparison, Value, and Operation.
The Trigger sets off the logic block or the comparison. Triggers range from mouse events to player window size to variables. For example, if you wanted to hide a skin element when viewed on a phone, you could add a logic block to the Visible attribute and use either the Player Width trigger or the Is Mobile trigger. View all available Triggers.
The type of comparison operator available depends on the Trigger. Triggers like Player Width will have a number value, and some triggers will have a text or string value, like the Tag trigger. Some triggers can have more than one type of comparison. For example, Placeholders can use =/≠, string values, and regular expressions.
Most triggers will use the following the comparison values:
=– Equal to
≠– Not equal to
<– Less than
<=– Less than or equal to
>– Greater than
>=– Greater than or equal to
Triggers that use string values, like “Tags and Langauge, use comparisons for text:
- contain – The Trigger has the value
- not contain – The Trigger does not have the value
- start with – the Trigger starts with the value given
- end with – The Trigger ends with the value given
Some Triggers, like Node ID, can use Regular Expressions as the comparison.
- regular expression – Enter a regular expression for the value to compare. ★ Note that
#is not used in the syntax for Triggers (as it is for Actions).
Values in Logic Blocks are compared to Triggers to determine the result of the logic block. What is used as a value is determined by the Trigger. There are number values, string (text) values, and boolean values (true/false).
For example, Player Width requires a number value, while Tag, requires a string/text value.
Values can also be placeholders. Right-click in the value cell and the placeholder list will be available.
Operators allow us to compare multiple conditions to provide a result. For example, if you wanted to hide tooltips when a touch device is being used, you would add the following logic block to a text box’s visible attribute:
|Mouse Over Parent||=||True||AND|
So, these two expressions must be met if the text box is to be visible.
The Default Value is whatever was set in the properties panel of that property. In the above image, the logic block was applied to the Visible property and is set to false. That element is initially not visible. It will only become visible when the panorama is loading.
Some Logic Blocks have two modes: Additive and Absolute.
In Absolute Mode, each expression specifies a value for an element’s attribute, like Position. Pano2VR reads the expressions from the top of the list down to the bottom. The first true expression will be used.
In Additive Mode, every expression will be evaluated, and if true, its value will be added to or subtracted from the element’s default value. In the example below, if any of the expressions are true, the changes to the value will be made. This example is from the menu_right_slider element of the built-in skin, feather_orb.ggsk.
The lower section is for Transitions and is made available for expressions that will change their size, appearance, location, etc. Select Enabled to set the transition.
- Duration – Set the amount of time the transition should take to make the change.
- Easing Function – Choose how the transition behaves by selecting an easing option. Depending on the option, the change will accelerate or decelerate during the movement. Ease in, for example, will start slowly then accelerate. See the options in action:
- Delay – apply a delay to the transition in seconds.
Use the Delete button to remove the logic block.
Use the Copy and Paste buttons to copy and paste logic blocks to other elements.
Click Cancel to close the logic block without saving changes.
Click OK to save and apply the logic block.
To add a new expression, click the Add Expression button in the upper right corner. To delete an expression, click the red “x”.
Expressions are read from the top down. This means that the first expression found to be true will be used. If you need to change the order of the expression use the green arrows found next to each expression.
✭ For logic blocks that have two values (size, position, and scale), one value can can be left empty to use the parameter’s default value.