CodingTrain / CodingTrain/Suggestion-Box

setTimeout() in draw()

Open
#1,367 2 comments 0 reactions 0 assignees View on GitHub
Question Solved
Dominant language
No language data
Stars
570
Forks
85
PR merge metrics
No merged PRs in 30d

Description

hi,

i'm new to coding and have some problems understanding the setTimeout() and setInterval() functions. I want to use them to draw something every 2seconds. How do i do that?

I tried:
`function setup() {
createCanvas(400, 400);
}

function draw() {
background(220);
setInterval(doit,2000)
}

function doit(){
ellipse(200,200,20);
}`

That doesnt work. I guess that has to do with the loop of the draw-function. Can someone help?

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.