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

Changing screen drawing mode during execution messes with curr settings #306

Open
trych opened this issue Nov 29, 2018 · 0 comments
Open

Comments

@trych
Copy link
Contributor

trych commented Nov 29, 2018

Consider the following script:

// @include ~/Documents/basiljs/basil.js;

function draw() {

  for (var i = 0; i < 20; i++) {
    ellipse(random(width), random(height), 20);
  }

  stroke(20);
  fill(255, 0, 0);

  mode(HIDDEN);

  for (var i = 0; i < 20; i++) {
    ellipse(random(width), random(height), 20);
  }

  mode(VISIBLE);
}

The internal vars currFill and currStroke seem to be overwritten, as soon as mode is changed into hidden.

It works, if the code parts in question are moved behind the mode change:

// @include ~/Documents/basiljs/basil.js;

function draw() {

  for (var i = 0; i < 20; i++) {
    ellipse(random(width), random(height), 20);
  }

  mode(HIDDEN);

  stroke(20);
  fill(255, 0, 0);

  for (var i = 0; i < 20; i++) {
    ellipse(random(width), random(height), 20);
  }

  mode(VISIBLE);
}

Needs some investigation what is happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant