html+css+js粘土动画Doodle特效
发表日期: 2020-07-21 09:42:35 浏览次数:164
丽水网站推广【丽水官网推广哪个效果好】丽水百度竞价推广托管、丽水百度优化推广外包、丽水全网霸屏推广多少钱、丽水网络推广一年大概多少费
丽 ( lí ) 水,古称处州,浙江省辖陆地面积最大的地级市;位于浙江省西南部,坐标东经118°41′~120°26′和北纬27°25′~28°57′之间,地势以中山、丘陵地貌为主,由西南向东北倾斜;境设1个市辖区:莲都区,7县:青田县、缙云县、遂昌县、松阳县、云和县、庆元县、景宁县,代管1县级市:龙泉市;土地面积17275平方千米 ,截至2019年末,丽水户籍人口270.8万人,其中,城镇人口85.1万人,乡村人口185.7万人。
丽水被誉为“浙江绿谷”,境内海拔1000米以上的山峰有3573座,龙泉市凤阳山黄茅尖海拔1929米,庆元县百山祖海拔1856.7米,分别为浙江省第一、第二高峰。2005年1月,丽水市被命名为第三批国家级生态示范区;2009年12月,相继被命名为“中国优秀旅游城市”、“中国优秀生态旅游城市”。2010年12月23日,浙江省关注森林组委会正式发文授予丽水“浙江省森林城市”称号。丽水获评首批国家级生态保护与建设示范区。丽水人属江浙民系使用吴语,丽水文化属吴越文化。2017年11月,获全国文明城市称号。 2017年中国地级市全面小康指数排名第47。2018年11月,获评2018中国地级市全面小康指数46名。2018年12月12日,被命名为第二批“绿水青山就是金山银山”实践创新基地。
html+css+js粘土动画Doodle特效
准备好需要用到的图标。
新建html文档。
书写hmtl代码。
<div style="width:135px;height:156px;background:url(images/6_gumby11-initial-sprite.png) 0 0;" id="Div1"></div>
<div style="left:138px;top:40px;width:65px;height:102px;background:url(images/6_gumby11-initial-sprite.png) -270px 0;" id="Div2"></div>
<div style="left:196px;top:14px;width:67px;height:144px;background:url(images/6_gumby11-initial-sprite.png) -400px 0;z-index:90;" id="Div3"></div>
<div style="left:246px;top:-6px;width:98px;height:156px;background:url(images/6_gumby11-initial-sprite.png) -682px 0;" id="Div4"></div>
<div style="left:323px;top:50px;width:75px;height:108px;background:url(images/6_gumby11-initial-sprite.png) -534px 0;" id="Div5"></div>
书写css代码。
<style>
div{position:absolute;}
</style>
书写js代码。
<script language="javascript" >
window.onload = function () {
new animation({ element: "Div1", url: 'images/15_gumby11-blockheads.jpg', hover: function () { this.element.style.backgroundPositionX = '-135px'; }, blur: function () { this.element.style.backgroundPositionX = '0'; } });
new animation({ element: "Div2", url: 'images/16_gumby11-prickle.jpg', hover: function () { this.element.style.backgroundPositionX = '-335px'; }, blur: function () { this.element.style.backgroundPositionX = '-270px'; } });
new animation({ element: "Div3", url: 'images/17_gumby11-goo.png', hover: function () { this.element.style.backgroundPositionX = '-467px'; }, blur: function () { this.element.style.backgroundPositionX = '-400px'; } });
new animation({ element: "Div4", url: 'images/10_gumby11-gumby.jpg', hover: function () { this.element.style.backgroundPositionX = '-780px'; }, blur: function () { this.element.style.backgroundPositionX = '-682px'; } });
new animation({ element: "Div5", url: 'images/18_gumby11-pokey.png', hover: function () { this.element.style.backgroundPositionX = '-609px'; }, blur: function () { this.element.style.backgroundPositionX = '-534px'; } });
};
</script>
书写animationjs代码
<script>
function animation(options) {
var defaultOptions = { element: "", url: "", speed: 11, hover: function () { }, blur: function () { } };
this.init(options, defaultOptions);
};
animation.prototype = {
init: function (o1, o2) {
var me = this;
for (var p in o2) {
me[p] = o1[p] || o2[p];
}
me.element = document.getElementById(me.element);
me.delay = 1000 / me.speed;
me.step = 0;
me.defaultBackground = me.element.style.background;
me.defalutUrl = me.element.style.backgroundImage;
me.url = me.url || me.defalutUrl;
me.width = me.element.clientWidth;
me.height = me.element.clientHeight;
var img = new Image();
img.onload = function () {
me.cols = parseInt(img.width / me.width);
me.rows = parseInt(img.height / me.height);
me.frames = me.cols * me.rows;
me.element.onclick = function () {
me.play();
};
me.element.onmouseover = function () {
me.onhover();
};
me.element.onmouseout = function () {
me.onblur();
};
};
img.src = me.url;
}
, play: function () {
if (this.playing) {
return;
}
this.playing = true;
this.next();
},
onhover: function () {
if (!this.playing) {
this.hover();
}
},
onblur: function () {
if (!this.playing) {
this.blur();
}
},
next: function () {
var me = this;
me.step++;
if (me.step > me.frames) {
me.stop();
return;
}
var x = me.step % me.cols;
var y = parseInt(me.step / me.rows);
if (me.step % me.rows > 0) {
y++;
}
var position = "-" + (x - 1) * me.width + "px -" + (y - 1) * me.height + "px";
me.element.style.background = "url(" + me.url + ") " + position;
setTimeout(function () { me.next(); }, me.delay);
},
stop: function () {
var me = this;
me.step = 0;
me.playing = false;
me.element.style.background = me.defaultBackground;
}
};
</script>
代码整体结构。
查看效果。
7 月 20 日晚间消息,神州租车公告,已向港交所申请 7 月 21 日上午九时起复牌。
神州租车今日午间发布公告称,公司证券自 7 月 20 日下午 1 时起于港交所短暂停止买卖,以待刊发内幕消息公告。
今年 7 月 2 日,上汽集团发布公告称,公司全资子公司上海汽车香港投资有限公司 (简称 “上汽香港”),与神州优车及其子公司以及 AmberGem 签署《收购要约》。根据要约有关内容,上汽香港拟以股 3.10 港元的价格以现金出资方式收购神州优车及 AmberGem 所持有的神州租车不超过 6.1 亿股股份。
丽水网站推广【丽水官网推广哪个效果好】丽水百度竞价推广托管、丽水百度优化推广外包、丽水全网霸屏推广多少钱、丽水网络推广一年大概多少费