Fuzziness when switching sketches


#1

Hello,

I working on a kind of master sketch that can switch between sketches easily. The functionality is working great but for some reason when I switch to a different sketch it gets kinda fuzzy.

My program is setup like this:


var sketchArray = Object.kets(sketches);
var currentSketch = sketchArray[0];

function setup (){
  createCanvas()
}

function draw(){
  sketches[currentSketch].drawThis()
}

function switchSketch(){
  var nextPos = sketchArray.indexOf(currentSketch) + 1;
  if (nextPos < sketchArray.length){
    currentSketch = sketchArray[nextPos];
  } else {
    currentSketch = sketchArray[0];
  }
  sketches[currentSketch].setup();
}

var sketches = {
  sketch1: function(){
    function setupThis(){
      //some setup stuff
    }
    function drawThis(){
      // some draw stuff
    }
    return {
      setupThis: setupThis,
      drawThis: drawThis
    }
  }(),
  sketch2: // and so on
}

You can see what I mean by going here http://172.104.16.113/ . Pressing space will cycle through the sketches I have (don’t mind the picture that flashes at the beginning) and if you can back to the one you started at it will be fuzzy!

I appreciate any help I can get. Thank you in advance!!

-Zuii


#2

Honestly kinda hard to tell without all the code but I’m guessing you just forgot to set the stroke weight and color in the first sketch because it resembles the stroke from the last one in the sequence.


#3

Omg that totally fixed it! It’s so easy to overlook simple solutions haha. Thank you!