millis()

Returns the number of milliseconds since a sketch started running.

millis() keeps track of how long a sketch has been running in milliseconds (thousandths of a second). This information is often helpful for timing events and animations.

If a sketch has a setup() function, then millis() begins tracking time before the code in setup() runs. If a sketch includes asynchronous loading using async/await, then millis() begins tracking time as soon as the asynchronous code starts running.

millis() can also be used in shaders with p5.strands. The following example uses millis() to create time-based color transitions on a shape.

उदाहरण

सिंटैक्स

millis()

पैरामीटर्स

Returns

Number: number of milliseconds since starting the sketch.

संबंधित संदर्भ