Skip to content

Instantly share code, notes, and snippets.

@nus
Created February 20, 2011 11:49
Show Gist options
  • Save nus/835919 to your computer and use it in GitHub Desktop.
Save nus/835919 to your computer and use it in GitHub Desktop.
上下に文字が動く
<html>
<head>
<style type="text/css">
#test {
position: absolute;
top: 0px;
}
</style>
<script type="text/javascript">
var tid;
var count;
var fps;
onload = function() {
fps = 10
tid = setInterval("interval()", 1000 / fps);
count = 0;
}
function interval() {
count %= fps;
var gain = 10;
var id_test = document.getElementById("test");
id_test.style.top = Math.abs(fps * gain / 2 - gain * count);
count++;
}
</script>
<title>js-css PoinPoin</title>
<body>
<p id="test">js-css PoinPoin</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment