Created
June 1, 2017 16:04
-
-
Save patrickkettner/27e4338ae362a3430c03a0fa16705458 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/cozegok
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style id="jsbin-css"> | |
body { | |
height: 100vh; | |
width: 100vw; | |
background: transparent radial-gradient(at calc(var(--mouse-x, 0) * 100%) calc(var(--mouse-y, 0) * 100%), #ff0, #008000) no-repeat 0 0; | |
} | |
</style> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
'use strict'; | |
var root = document.documentElement; | |
document.addEventListener('mousemove', function (evt) { | |
var x = evt.clientX / innerWidth; | |
var y = evt.clientY / innerHeight; | |
root.style.setProperty('--mouse-x', x); | |
root.style.setProperty('--mouse-y', y); | |
}) | |
</script> | |
<script id="jsbin-source-css" type="text/css">body { | |
height: 100vh; | |
width: 100vw; | |
background: transparent radial-gradient(at calc(var(--mouse-x, 0) * 100%) calc(var(--mouse-y, 0) * 100%), #ff0, #008000) no-repeat 0 0; | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">'use strict'; | |
var root = document.documentElement; | |
document.addEventListener('mousemove', function (evt) { | |
var x = evt.clientX / innerWidth; | |
var y = evt.clientY / innerHeight; | |
root.style.setProperty('--mouse-x', x); | |
root.style.setProperty('--mouse-y', y); | |
})</script></body> | |
</html> |
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
body { | |
height: 100vh; | |
width: 100vw; | |
background: transparent radial-gradient(at calc(var(--mouse-x, 0) * 100%) calc(var(--mouse-y, 0) * 100%), #ff0, #008000) no-repeat 0 0; | |
} |
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
'use strict'; | |
var root = document.documentElement; | |
document.addEventListener('mousemove', function (evt) { | |
var x = evt.clientX / innerWidth; | |
var y = evt.clientY / innerHeight; | |
root.style.setProperty('--mouse-x', x); | |
root.style.setProperty('--mouse-y', y); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment