Skip to content
Related Articles

Related Articles

p5.js accelerationY variable

View Discussion
Improve Article
Save Article
  • Last Updated : 10 May, 2021

The accelerationY system variable is responsible for the acceleration of the device(tablets or mobile phones) along the y-axis. It can be used with the draw() function to accelerate the device in the y-axis of the coordinate system.

Its Value is represented as meters per second squared.



Example 1:


// Move a touchscreen device to register
// Acceleration changes.
function setup()
function draw() {
  // Convert the acceleration into integer when
  // Device is moved along y-axis.


Example 2:


// Move a touchscreen device to register
// acceleration changes.
function draw() {
  //Set the variable.
  square(width/2, height/2, accelerationY);


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!