Skip to content

Instantly share code, notes, and snippets.

@hyqhyq3
Created October 21, 2012 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hyqhyq3/3925580 to your computer and use it in GitHub Desktop.
Save hyqhyq3/3925580 to your computer and use it in GitHub Desktop.
牌面翻转
var t = new Date().getTime()
function getTime() {
return (new Date().getTime()-t)/1000;
}
function fun(n,order) {
console.log(getTime(),"卡片" + n + "正面")
setTimeout(function(){
console.log(getTime(),"卡片" + n + "反面")
setTimeout(function(){
fun((n+1)%4, order+1)
}, (order +1) * 5000)
}, 5000)
}
setTimeout(function(){fun(0,1)},5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment