Team:StuyGem NYC

From 2014hs.igem.org

(Difference between revisions)
Line 205: Line 205:
  }
  }
-
function writeMessage(canvas, message) {
+
canvas.addEventListener('mousemove', function(evt){
-
        var ctx = canvas.getContext('2d');
+
  var mousePos = getMousePos(canvas, evt);
-
        ctx.clearRect(0, 0, canvas.width, canvas.height);
+
if ((mousePos.x < 250) && (mousePos.y < 250)) {
-
        ctx.font = '18pt Calibri';
+
imageObj.src = 'https://static.igem.org/mediawiki/2014hs/4/42/TeamOn.png';
-
        ctx.fillStyle = 'black';
+
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/7/79/Parts.png';
-
        ctx.fillText(message, 10, 25);
+
imageObj3.src = 'https://static.igem.org/mediawiki/2014hs/1/16/Sponsors.png';
-
      }
+
imageObj4.src = 'https://static.igem.org/mediawiki/2014hs/9/92/Project.png';
 +
}
 +
else if ((mousePos.x < 250) && (mousePos.y >= 250)) {
 +
imageObj.src = 'https://static.igem.org/mediawiki/2014hs/3/32/Team.png';
 +
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/4/4e/PartsOn.png';
 +
imageObj3.src = 'https://static.igem.org/mediawiki/2014hs/1/16/Sponsors.png';
 +
imageObj4.src = 'https://static.igem.org/mediawiki/2014hs/9/92/Project.png';
 +
}
 +
else if ((mousePos.x >= 250) && (mousePos.y < 250)) {
 +
imageObj.src = 'https://static.igem.org/mediawiki/2014hs/3/32/Team.png';
 +
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/7/79/Parts.png';
 +
imageObj3.src = 'https://static.igem.org/mediawiki/2014hs/2/20/SponsorsOn.png';
 +
imageObj4.src = 'https://static.igem.org/mediawiki/2014hs/9/92/Project.png';
 +
}
 +
else if ((mousePos.x >= 250) && (mousePos.y >= 250)) {
 +
imageObj.src = 'https://static.igem.org/mediawiki/2014hs/3/32/Team.png';
 +
imageObj2.src = 'https://static.igem.org/mediawiki/2014hs/7/79/Parts.png';
 +
imageObj3.src = 'https://static.igem.org/mediawiki/2014hs/1/16/Sponsors.png';
 +
imageObj4.src = 'https://static.igem.org/mediawiki/2014hs/4/4b/ProjectOn.png';
 +
}
 +
  }
 +
  );
-
      var ctx = canvas.getContext('2d');
 
-
 
-
      canvas.addEventListener('mousemove', function(evt) {
 
-
        var mousePos = getMousePos(canvas, evt);
 
-
        var message = 'Mouse position: ' + mousePos.x + ',' + mousePos.y;
 
-
        writeMessage(canvas, message);
 
-
      }, false);
 
</script>
</script>
   </body>
   </body>
</html>
</html>

Revision as of 02:52, 17 April 2014


StuyGem NYC





Get in touch!

Visit Our Twitter Page!