Variables

As mentioned earlier, as of version 3.9, ProtoPie supports variables. These variables can hold text, number or color values. The value of a variable can be modified using the Assign response, while the Detect trigger would be activated based on any changes that a layer or variable undergoes. You can use variables instead of using fixed values for responses, e.g. Move, Scale, Rotate and others.

Variables for all scenes

A variable for all scenes is a variable that is usable in all scenes in ProtoPie, and it can also be used for interactions between scenes. It is possible for the value of a variable for all scenes to be changed in Scene A, and after jumping from Scene A to Scene B, the changes in the variable would be visible in the new scene.

Variables for this scene only

A variable for this scene only is a variable that is usable only in the scene where the variable is created. This means that a variable created in Scene A cannot be used in Scene B.

Variable Types

Variables can be one of the three types: a number, text or color type. These variables hold different values based on their type.

Text

A text variable can only hold text as a value. Any number used as a value for a text variable will be treated as text.

Number

A number variable can only hold numbers as a value. Any non-number used as a value for a number variable will result in an error.

Color

A color variable can only hold values in the #FFFFFF format (Hex color code). Any non-color value used as a value for a color variable will result in an error.

Variable Display

Values of variables can be displayed in the canvas and in Preview. This way, you can make sure that your variables are storing the correct values.

Predefined Variable

These are variables that have been predefined within ProtoPie.

  • $mouseXThe x-coordinate of a mouse pointer
  • $mouseYThe y-coordinate of a mouse pointer.
  • $touchXThe x-coordinate of a point where a touch is registered.
  • $touchYThe y-coordinate of a point where a touch is registered.
  • $touchVelocityThe velocity of a touch using a finger or mouse that is in movement.
  • $touchVelocityXThe x-component of the velocity of a touch using a finger or mouse that is in movement.
  • $touchVelocityYThe y-component of the velocity of a touch using a finger or mouse that is in movement.
  • $touchPointerCountThe number of fingers that are touching the screen.
  • $keyboardHeightThe height of a native keyboard on a smart device when it is visible.
  • $deviceOSThe operating system of the device on which the prototype is running.
  • $piPi (3.141592).
  • $timeTime after running Pie (seconds). If you want to figure out the time passed since a certain event, you should assign the time when the event occurs to a variable and deduct it from the $time value.