Created
February 20, 2011 11:49
-
-
Save nus/835919 to your computer and use it in GitHub Desktop.
上下に文字が動く
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
<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