Skip to content

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

Open
@trych

Description

@trych

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions