Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active April 2, 2016 23:39
Show Gist options
  • Save aaizemberg/3d58580fa947cc1938d44df0b2b78f71 to your computer and use it in GitHub Desktop.
Save aaizemberg/3d58580fa947cc1938d44df0b2b78f71 to your computer and use it in GitHub Desktop.
La flecha de Zenón
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>http://www.jorgemacchi.com/en/works/253/la-flecha-del-zenon</title>
<style>
.centered {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
</head>
<body>
<h1 class="centered" style="font-size:256px"></h1>
<script>
var from = 10; // counter
var fs = 256; // font-size
var timer = setInterval(update, 1000);
d3.select("h1").text(from);
function update() {
if (from > 1) {
from = from - 1;
}
else {
from = from / 2;
fs = fs / 1.25;
}
d3.select("h1").style("font-size",fs+"px").text(from);
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment