Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.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 将精灵图像转换为CSS动画_Javascript_Jquery_Css - Fatal编程技术网

Javascript 将精灵图像转换为CSS动画

Javascript 将精灵图像转换为CSS动画,javascript,jquery,css,Javascript,Jquery,Css,我有一个精灵图像,我想给它制作动画,下面是实际的动画。我只是复制了一些其他网站的代码进行编码。它使用了一些名为motio 2.2的框架,但问题是它在IOS中不起作用。下面是示例代码,这里是演示 我想使用Css、Javascript或jquery为以下图像设置动画 http://www.humanverify.net/captchalocker/img/blue-circle-anim.png http://www.humanverify.net/captchalocker/img/blue-c

我有一个精灵图像,我想给它制作动画,下面是实际的动画。我只是复制了一些其他网站的代码进行编码。它使用了一些名为motio 2.2的框架,但问题是它在IOS中不起作用。下面是示例代码,这里是演示

我想使用Css、Javascript或jquery为以下图像设置动画

http://www.humanverify.net/captchalocker/img/blue-circle-anim.png

http://www.humanverify.net/captchalocker/img/blue-circle-loading-anim.png
到目前为止我试过什么

var imgHeight = 2844;
var numImgs = 100;
var cont = 0;
var img = $('#container').find('img');

var animation = setInterval( moveSprite,100);

function moveSprite(){
    img.css('margin-top', -1 * (cont*imgHeight));

    cont++;
    if(cont == numImgs){
        clearInterval(animation);
    }
}

有些人喜欢这项工作吗?你可以随心所欲地给它上色:谢谢你的评论,这只是旋转图像,它对图像不起作用,像这样的东西会起作用吗?你可以随意给它上色:谢谢你的评论,这只是旋转图像,它不适合像这样的图像
var imgHeight = 2844;
var numImgs = 100;
var cont = 0;
var img = $('#container').find('img');

var animation = setInterval( moveSprite,100);

function moveSprite(){
    img.css('margin-top', -1 * (cont*imgHeight));

    cont++;
    if(cont == numImgs){
        clearInterval(animation);
    }
}