大佬教程收集整理的这篇文章主要介绍了使用Raphael和Javascript使矢量点闪烁,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用for循环来创建点,然后让它们淡入淡出.有没有办法可以淡出,我可以删除它们?
我对Javascript很新,所以我不知道处理这个的最好的策略.我在拉斐尔文档中看不到如何做到这一点.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>blink point</title> <script src="js/raphael.js"></script> <!--<script src="https://github.com/DmitryBaranovskiy/raphael/raw/master/raphael-min.js"></script>--> <script type="text/javascript"> window.onload = function () { //Point array pointList = new Array (); // Create Canvas var r = Raphael(10,50,600,600); // Make a 'group' of points for( i=0; i<20; i++){ //Create Point pointList[i] = r.circle(10*i,10*i,5); pointList[i].attr({stroke: "none",fill: "#999",opacity: 0}); //Fade in pointList[i].animate({opacity: 1},1000 ); } // Remove points,starTing with the first for( i=0; i<20; i++){ //Try fading them out //pointList[i].animate({opacity: 0},1000 ); } }; </script> </head> <body> <div id="holder"></div> </body> </html>
我也无法获得Raphael图书馆的在线链接,因此可能需要下载该图书馆.
您的代码的问题 – 动画是异步完成的,这意味着您的程序将在渐变之前完成.
所以当动画准备就绪时,需要设置回调函数.这是拉斐尔文件的引用:
最后一个参数是我们需要的.您只需要分配功能即可在动画完成后调用.
以上是大佬教程为你收集整理的使用Raphael和Javascript使矢量点闪烁全部内容,希望文章能够帮你解决使用Raphael和Javascript使矢量点闪烁所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。