p5.js rotateX() function Last Updated : 17 Aug, 2023 Comments Improve Suggest changes Like Article Like Report The rotateX() function in p5.js is used to rotate the shape or an object around the x-axis.Syntax: rotateX(angle) Parameters: This function accepts single parameter angle which stores the angle by which rotation is to be done.Below programs illustrate the rotateX() function in p5.js:Example 1: This example uses rotateX() function to rotate an object around the x-axis. javascript function setup() { // Create Canvas of given size createCanvas(800, 550, WEBGL); } function draw() { // Set the background color background(220); // Set stroke weight strokeWeight(12); // Rotation function rotate(PI / 7.0); // Call to rotateX function rotateX(millis() / 1000); // Draw rectangle rect(3, 3, 200, 39); // Draw ellipse ellipse(160, 160, 40, 40); } Output: Example 2: This example uses rotateX() function to rotate an object around the x-axis. javascript function setup() { // Create canvas of given size createCanvas(500, 500, WEBGL); } function draw() { // Set background color background(200); // Set property to rotate the // shape about the x-axis rotateX(frameCount * 0.01); // Set stroke weight strokeWeight(2); // Set fill color fill("green"); // Draw of height 100 and radius 50 cylinder(50, 100); } Output: Reference: https://p5js.org/reference/#/p5/rotateX Create Quiz Comment S sarthak_ishu11 Follow 0 Improve S sarthak_ishu11 Follow 0 Improve Article Tags : JavaScript Web Technologies JavaScript-p5.js Explore JavaScript BasicsIntroduction to JavaScript4 min readVariables and Datatypes in JavaScript6 min readJavaScript Operators5 min readControl Statements in JavaScript4 min readArray & StringJavaScript Arrays7 min readJavaScript Array Methods7 min readJavaScript Strings5 min readJavaScript String Methods9 min readFunction & ObjectFunctions in JavaScript5 min readJavaScript Function Expression3 min readFunction Overloading in JavaScript4 min readObjects in JavaScript4 min readJavaScript Object Constructors4 min readOOPObject Oriented Programming in JavaScript3 min readClasses and Objects in JavaScript4 min readWhat Are Access Modifiers In JavaScript ?5 min readJavaScript Constructor Method7 min readAsynchronous JavaScriptAsynchronous JavaScript2 min readJavaScript Callbacks4 min readJavaScript Promise4 min readEvent Loop in JavaScript4 min readAsync and Await in JavaScript2 min readException HandlingJavascript Error and Exceptional Handling6 min readJavaScript Errors Throw and Try to Catch2 min readHow to create custom errors in JavaScript ?2 min readJavaScript TypeError - Invalid Array.prototype.sort argument1 min readDOMHTML DOM (Document Object Model)8 min readHow to select DOM Elements in JavaScript ?3 min readJavaScript Custom Events4 min readJavaScript addEventListener() with Examples9 min readAdvanced TopicsClosure in JavaScript4 min readJavaScript Hoisting6 min readScope of Variables in JavaScript3 min readJavaScript Higher Order Functions7 min readDebugging in JavaScript4 min read Like