레퍼런스 millis()

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()

매개변수

반환값

Number: number of milliseconds since starting the sketch.

관련 레퍼런스