Widget:樱花飘落:修订间差异
跳到导航
跳到搜索
imported>=海豚= 无编辑摘要 |
imported>=海豚= 无编辑摘要 |
||
(未显示同一用户的1个中间版本) | |||
第1行: | 第1行: | ||
<noinclude><nowiki>满</nowiki></noinclude><includeonly> | <noinclude><nowiki>满 屏樱花飘落</nowiki></noinclude><includeonly> | ||
<script> | <script> | ||
(function() { | var pixelRatio = (function() { | ||
var canvas = document.createElement('canvas'), | |||
context = canvas.getContext('2d'), | |||
backingStore = context.backingStorePixelRatio || | |||
context.webkitBackingStorePixelRatio || | |||
context.mozBackingStorePixelRatio || | |||
context.msBackingStorePixelRatio || | |||
context.oBackingStorePixelRatio || | |||
context.backingStorePixelRatio || 1; | |||
return (window.devicePixelRatio || 1) / backingStore; | |||
})() | |||
var winWidth = (function() { return window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; })() | |||
var winHeight = (function() { return window.innerHeight || document.documentElement.clientWidth || document.body.clientHeight; })() | |||
var pixwinWidth = (function() { return winWidth*pixelRatio;})() | |||
var pixwinHeight = (function() { return winHeight*pixelRatio;})() | |||
var stop, staticx; | var stop, staticx; | ||
var img = new Image(); | var img = new Image(); | ||
第25行: | 第42行: | ||
this.y = this.fn.y(this.y, this.y); | this.y = this.fn.y(this.y, this.y); | ||
this.r = this.fn.r(this.r); | this.r = this.fn.r(this.r); | ||
if (this.x > | if (this.x > pixwinWidth || this.x < 0 || this.y > pixwinHeight || this.y < 0) { | ||
this.r = getRandom('fnr'); | this.r = getRandom('fnr'); | ||
if (Math.random() > 0.4) { | if (Math.random() > 0.4) { | ||
第33行: | 第50行: | ||
this.r = getRandom('r'); | this.r = getRandom('r'); | ||
} else { | } else { | ||
this.x = | this.x = pixwinWidth; | ||
this.y = getRandom('y'); | this.y = getRandom('y'); | ||
this.s = getRandom('s'); | this.s = getRandom('s'); | ||
第67行: | 第84行: | ||
switch (option) { | switch (option) { | ||
case 'x': | case 'x': | ||
ret = Math.random() * | ret = Math.random() * pixwinWidth; | ||
break; | break; | ||
case 'y': | case 'y': | ||
ret = Math.random() * | ret = Math.random() * pixwinHeight; | ||
break; | break; | ||
case 's': | case 's': | ||
第105行: | 第122行: | ||
cxt; | cxt; | ||
staticx = true; | staticx = true; | ||
canvas.height = | canvas.height = pixwinHeight/1.3; | ||
canvas.width = | canvas.width = pixwinWidth/1.3; | ||
canvas.setAttribute('style', 'position: fixed;left: 0;top: 0;pointer-events: none;'); | canvas.setAttribute('style', 'position: fixed;left: 0;top: 0;pointer-events: none;z-index:99999;'); | ||
canvas.style.height = winHeight+"px"; | |||
canvas.style.width = winWidth+"px"; | |||
canvas.setAttribute('id', 'canvas_sakura'); | canvas.setAttribute('id', 'canvas_sakura'); | ||
document.getElementsByTagName('body')[0].appendChild(canvas); | document.getElementsByTagName('body')[0].appendChild(canvas); | ||
第130行: | 第150行: | ||
} | } | ||
stop = requestAnimationFrame(function () { | stop = requestAnimationFrame(function () { | ||
cxt.clearRect(0, 0, | cxt.clearRect(0, 0, pixwinWidth, pixwinHeight); | ||
sakuraList.update(); | sakuraList.update(); | ||
sakuraList.draw(cxt); | sakuraList.draw(cxt); | ||
第153行: | 第173行: | ||
} | } | ||
} | } | ||
</script></includeonly> | </script></includeonly> |
2021年6月25日 (五) 20:51的最新版本
满屏樱花飘落