Skip to content

Instantly share code, notes, and snippets.

@starzonmyarmz
Created December 22, 2011 21:48
Show Gist options
  • Save starzonmyarmz/1512003 to your computer and use it in GitHub Desktop.
Save starzonmyarmz/1512003 to your computer and use it in GitHub Desktop.
fooling around with css and javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>untitled</title>
<style>
body {
margin: 50px;
}
div {
border: 1px solid #000;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
color: #000;
font-family: HelveticaNeue-Light;
height: 100px;
margin: 0 auto;
width: 100px;
}
</style>
</head>
<body>
<div id="btn"></div>
<script>
var z = 0;
var goingUp = true;
var b = document.getElementById('btn');
var x = function() {
b.style.borderRadius = z + 'px';
b.style.borderWidth = z + 'px';
b.style.opacity = z * .01 ;
if (goingUp) {
z += 1;
if (z > 100 / 2) {
goingUp = false;
}
} else {
z -= 1;
if (z < 1) {
goingUp = true;
}
}
}
var y = setInterval(x, 10);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment