Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

While loop can't function properly #5931

Closed
fml-123 opened this issue Sep 20, 2020 · 1 comment
Closed

While loop can't function properly #5931

fml-123 opened this issue Sep 20, 2020 · 1 comment

Comments

@fml-123
Copy link

fml-123 commented Sep 20, 2020

I am new to coding and I am learning how to create animations by coding

I want to use loop to make the clouds move left and right constantly, so I wrote the following code

var xc1 = 380
function setup() {
createCanvas(600,600);
background(0);
frameRate(10);
.
.
.
function draw() {
xc1 = (xc1 + 50) % 600;

  var i = 0;
  while(i < 900){
  ellipse(xc1, 150, 60, 30);
  ellipse(xc1 + 20, 130, 60, 30);;
  ellipse(xc1 + 40, 150, 60, 30);
  i ++ ;
}

}

However, when I started to run the code
the cloud didn't move left and right but becoming more and more
more and more clouds appeared horizontally

Do anybody know how to fix this? Thank you so much!!!

@domenic
Copy link
Member

domenic commented Sep 20, 2020

Sorry, this is not a venue for asking for help on programming. I suggest https://stackoverflow.com/.

@domenic domenic closed this as completed Sep 20, 2020
@whatwg whatwg locked as off-topic and limited conversation to collaborators Sep 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants