jquery实现多张图片序列帧播放动画效果代码
代码语言:html
所属分类:动画
代码描述:jquery实现多张图片序列帧播放动画效果代码,这是十几张图片连续更换产生的动画效果。
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html lang="en"> <head> <meta charset="UTF-8"> <style> body{ background: white; padding: 0; margin: 0; } .master-animation { position: absolute; filter:brightness(110%); width: 440px; display: block; } </style> </head> <body> <img class="master-animation" src="//repo.bfw.wiki/bfwrepo/images/master/Image2.png" alt="blinking master animation"> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script> <script> const $element = $('.master-animation'); const imagePath = '//repo.bfw.wiki/bfwrepo/images/master'; const totalFrames = 15; const animationDuration = 2300; const timePerFrame = animationDuration / totalFrames; let timeWhenLastUpdate; let timeFromLastUpdate; let frameNumber = 2; function step(startTime) { if (!timeWhenLastUpdate) timeWhenLastUpdate = startTime; timeFromLastUpdate = startTime - timeWhenLastUpdate; // then.........完整代码请登录后点击上方下载按钮下载查看
网友评论0