Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/440.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript index.html不显示动画gif/webm格式_Javascript - Fatal编程技术网

Javascript index.html不显示动画gif/webm格式

Javascript index.html不显示动画gif/webm格式,javascript,Javascript,我正在开发一个简单的javascript项目,该项目使用Spreader.js(如上所示)将图形放入Spreader中。如果使用png/jpeg等典型图像格式,效果会非常好,但我想知道是否有一种方法可以使用.gif/.webm/或视频格式来显示要喷洒的动画。到目前为止,尝试将gif替换为我当前的png还没有成功。提前非常感谢 这是我的密码: Index.html: <!DOCTYPE html> <html lang="en"> <head> <

我正在开发一个简单的javascript项目,该项目使用Spreader.js(如上所示)将图形放入Spreader中。如果使用png/jpeg等典型图像格式,效果会非常好,但我想知道是否有一种方法可以使用.gif/.webm/或视频格式来显示要喷洒的动画。到目前为止,尝试将gif替换为我当前的png还没有成功。提前非常感谢

这是我的密码:

Index.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Test</title>
</head>
<body>
    <canvas id="canvas" width="1920" height="1080"></canvas>

    <script src="https://unpkg.com/sprinkler@1.9.0/dist/sprinkler.min.js"></script>
</body>
</html>
var c = document.getElementById('canvas')
var s = sprinkler.create(c)
var audio = new Audio('test.mp3');

function sprinkle(message) {
    audio.play();

    var images = [
        'Test1.png',
        'Test2.png'
      ]
      var stop = s.start(images, {
        ddyMin: 200,
        ddyMax: 200
      })
      setTimeout(function(){
        stop();
        audio.pause();
        audio.currentTime = 0;
      }, 6000)
}