Created
February 20, 2015 23:05
-
-
Save martimatix/691c41e2594b7110a66e to your computer and use it in GitHub Desktop.
Colr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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