Device Motion

Block Group: Browser API
Block Icon: Device Motion block icon

Returns the current DeviceMotionEvent acceleration, acceleration including gravity, and rotation of the device, if available.


Input/Output Properties

This property can take input and give output.

  • enabled (boolean)

enabled specifies whether the device motion is currently being tracked and reported.


Output Properties

These properties can give output. They cannot take input.

  • accelerationX
  • accelerationY
  • accelerationZ
  • accelerationGX
  • accelerationGY
  • accelerationGZ
  • rotationAlpha
  • rotationBeta
  • rotationGamma

accelerationX, accelerationY, and accelerationZ return the acceleration of the device along the X, Y, and Z axes, in meters per second squared (m/s2).

  • The X axis typically extends from the left edge of the screen to the right edge of the screen.
  • The Y axis typically extends from the top edge of the screen to the bottom edge of the screen.
  • The Z axis typically extends from the back of the device to the front of the device.

accelerationGX, accelerationGY, and accelerationGZ return the acceleration of the device along the X, Y, and Z axes, in meters per second squared (m/s2). Unlike the other acceleration values, these do not compensate for the influence of gravity. These values might be useful for devices where the first set of values is not available, such as on devices without a gyroscope.

rotationAlpha returns the rate of change of the roll, or rotation around the Z axis, of the device, in degrees per second. This movement typically looks like a change between horizontal and vertical orientation of the screen.

rotationBeta returns the rate of change of the pitch, or rotation around the X axis, of the device, in degrees per second. This movement typically looks like moving the bottom or top of the screen forward or backward.

rotationGamma returns the rate of change of the yaw, or rotation around the Y axis, of the device, in degrees per second. This movement typically looks like moving the left or right side of the screen forward or backward.


Model

These are basic uses of the block.

Dataflow Model Description
Device Motion dataflow modelThe rounded accelerationX value, concatenated with an identifying text string, is bound to the Text property of the Text component. When the page is opened on a device that monitors motion, the text component will report the accelerationX value.