有bug,點show后點reset不會歸位
將theAnimation定義為全局變量,具體代碼:(三處改動)
1、在函數外部定義 var theAnimation;
2、function initCanvas(){
clearInterval(theAnimation); //在initCanvas添加一行代碼
3、function show(){
clearInterval(theAnimation); //添加一行代碼,清除定時器
theAnimation = setInterval(function(){ // 把前面的var去掉
將theAnimation定義為全局變量,具體代碼:(三處改動)
1、在函數外部定義 var theAnimation;
2、function initCanvas(){
clearInterval(theAnimation); //在initCanvas添加一行代碼
3、function show(){
clearInterval(theAnimation); //添加一行代碼,清除定時器
theAnimation = setInterval(function(){ // 把前面的var去掉
有bug,點show后點reset出錯
將theAnimation定義為全局變量,具體代碼:(三處改動)
1、在函數外部定義 var theAnimation;
2、function initCanvas(){
clearInterval(theAnimation); //在initCanvas添加一行代碼
3、function show(){
clearInterval(theAnimation); //添加一行代碼,清除定時器
theAnimation = setInterval(function(){ // 把前面的var去掉
將theAnimation定義為全局變量,具體代碼:(三處改動)
1、在函數外部定義 var theAnimation;
2、function initCanvas(){
clearInterval(theAnimation); //在initCanvas添加一行代碼
3、function show(){
clearInterval(theAnimation); //添加一行代碼,清除定時器
theAnimation = setInterval(function(){ // 把前面的var去掉