「Widget:樱花飘落」:修訂間差異

跳至導覽 跳至搜尋
增加 893 位元組 、​ 2021年6月25日 (星期五)
無編輯摘要
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 > window.innerWidth || this.x < 0 || this.y > window.innerHeight || this.y < 0) {
    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 = window.innerWidth;
        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() * window.innerWidth;
        ret = Math.random() * pixwinWidth;
        break;
        break;
      case 'y':
      case 'y':
        ret = Math.random() * window.innerHeight;
        ret = Math.random() * pixwinHeight;
        break;
        break;
      case 's':
      case 's':
行 105: 行 122:
      cxt;
      cxt;
    staticx = true;
    staticx = true;
    canvas.height = window.innerHeight;
    canvas.height = pixwinHeight/1.3;
    canvas.width = window.innerWidth;
    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, canvas.width, canvas.height);
      cxt.clearRect(0, 0, pixwinWidth, pixwinHeight);
      sakuraList.update();
      sakuraList.update();
      sakuraList.draw(cxt);
      sakuraList.draw(cxt);
行 153: 行 173:
    }
    }
}
}
})();
</script></includeonly>
</script></includeonly>
匿名使用者

導覽選單