Skip to content

Instantly share code, notes, and snippets.

@martimatix
Created February 20, 2015 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martimatix/691c41e2594b7110a66e to your computer and use it in GitHub Desktop.
Save martimatix/691c41e2594b7110a66e to your computer and use it in GitHub Desktop.
Colr
// Requires pusher.js from http://surfacecurve.org:8708/libraries/color
// Curl command:
// curl http://surfacecurve.org:8708/platform/pusher/script/pusher.color.js > js/pusher.js
// Add this to html before colr.js:
// <script src="js/pusher.js"></script>
$(window).on('mousemove', function (event) {
var hue = Math.round((event.pageX / window.innerWidth) * 360);
var y = event.pageY / window.innerHeight;
var saturation = Math.round(100 * Math.cos(y * Math.PI / 2));
var brightness = Math.round(100 * Math.sin(y * Math.PI / 2));
var color = pusher.color('hsv', [hue, saturation, brightness]).hex6()
$('body').css('background-color', color);
$('#colour').val(color);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment