基本信息
源码名称:原生JavaScript实现精美放羊动画效果
源码大小:9.96M
文件格式:.zip
开发语言:js
更新时间:2020-01-30
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 8 元 
   源码介绍


注:小绵羊是可以拖动的

css文件夹中style.css为主要的样式文件
js文件夹中sheep.js为动画效果功能文件
image中为所用到的图片资源目录
music中为所用到的背景音乐目录
index.html为演示文件







var sheepAnimate = setInterval(function(){ 
                    sheep.num = sheep.num sheep.sheepWith;
                    if(sheep.num == (sheep.sheepWith*8)){ 
                        sheep.num = 0;
                    }
                // console.log(sheep.num);
                    sheep.sheep.style.backgroundPosition = -sheep.num 'px ' sheep.top 'px';
                },sheep.frequencyNum);

                //实现整个羊走的(位移)动画
                var sheepRun = setInterval(function(){
                    sheep.cot = sheep.sheep.offsetLeft-sheep.speed;
                    if(sheep.cot<=-sheep.sheepWith){
                        clearInterval(sheepRun);
                        clearInterval(sheepAnimate);
                        sheep.stage.removeChild(sheep.sheep);
                    }
                    //console.log(sheep.cot);
                    sheep.sheep.style.left =  sheep.cot 'px';
                },sheep.frequencyNum)