Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 1.42 KB

lecture12.more_of_this_and_dat_gui.md

File metadata and controls

49 lines (38 loc) · 1.42 KB

Getting started & review

using dat.gui

window.onload = function() {
  var canvas = document.querySelector('canvas')
  var ctx = canvas.getContext('2d')
  var color = {
    red:0,
    green:0,
    blue:0
  }
  
  var draw = function() {
    window.requestAnimationFrame( draw )
    ctx.fillStyle = `rgb( ${color.red}, ${color.green}, ${color.blue} )`
    ctx.fillRect( 0,0,canvas.width,canvas.height )
  }
  
  var gui = new dat.GUI()
  gui.add( color, 'red', 0, 255 ).step(1)
  gui.add( color, 'green', 0, 255 ).step(1)
  gui.add( color, 'blue', 0, 255 ).step(1)
  
  draw()
}

ICE - Boomshine Part II

Reading