The deviceMoved() function runs when the mobile device displaying the sketch moves. In this example, the accelerationX, accelerationY, and accelerationZ values set the position and size of a circle. This only works for mobile devices.
Mobile Device Movement by p5.js Contributors and the Processing Foundation is licensed under CC BY-NC-SA 4.0.