Checks whether the specified key is pressed.
Example — Whenever the user clicks, create a circle shaped path. If the 'a' key is pressed, fill it with red, otherwise fill it with blue:
function onMouseDown(event) {
var path = new Path.Circle(event.point, 10);
if (Key.isDown('a')) {
path.fillColor = 'red';
} else {
path.fillColor = 'blue';
}
}
Copyright © 2011 Jürg Lehni & Jonathan Puckey. All Rights Reserved.