LeCiell / Mithryl

Fish tank project
https://leciell.github.io/Mithryl/
MIT License
0 stars 1 forks source link

Tips #1

Open mdvanes opened 4 years ago

mdvanes commented 4 years ago

semi random color:

 var rCounter = 0;
 var bCounter = 0;
 var gCounter = 0;
  var randomColor = function() {
      rCounter += 10;
      bCounter += 5;
      gCounter += 15;
      return color(rCounter, bCounter, gCounter);
  };
mdvanes commented 4 years ago

iteration:

for(var i = 20; i < 600; i += 50) {
    drawFish(i, 100 + i*0.5, randomColor(), -30, 28);
}
mdvanes commented 4 years ago

Fix for drawing the scene once (and not calling randomColor on each frame):

// Draw the Scene once
drawScene();
// Make a copy of the entire canvas
var sceneCopy = get();

var bubbleSize = 6;
var centreBX = (250);
var centreBY = (350);

// Draw Frame
draw = function () {
  // On each frame, instead of redrawing scene (which calls "randomColor each time")...
  // drawScene();
  // ... just paste the copy
  image(sceneCopy, 0, 0)
  // Bubble
  stroke(5, 242, 230);
  noFill();
  ellipse(377, 250, bubbleSize, bubbleSize);
};