|
|
(未显示另一用户的1个中间版本) |
第10行: |
第10行: |
|
| |
|
| ==代码试验区== | | ==代码试验区== |
| {{#Widget:Audio|param=data:audio/{{{1|wav}}};base64,{{{2|}}}}} | | {{Audio|ogg}} |
|
| |
|
| 来帮忙(死)这玩意到底怎么用{{用户:Kaltes Eis/Eine Unterschrift}} 2022年4月6日 (三) 03:31 (UTC) | | 来帮忙(死)这玩意到底怎么用{{用户:Kaltes Eis/Eine Unterschrift}} 2022年4月6日 (三) 03:31 (UTC) |
| | | :现在差不多了,虽然第二项什么都没填( |
| body,html{undefined
| | :我填ogg那个地方可以改成其他音频格式 |
| overflow: hidden;
| | :以后玩这个时记得再加一个base64的编码音频--[[用户:Goldenaxe|Goldenaxe]]([[用户讨论:Goldenaxe|留言]]) 2022年4月6日 (三) 08:36 (UTC) |
| }
| |
| var snowflakes = {undefined
| |
| arr:[],
| |
| snowflake : [
| |
| '❉',
| |
| '❈',
| |
| '*',
| |
| '✲',
| |
| '❀',
| |
| '❃'
| |
| ],
| |
| snowflakeColor : [
| |
| "red",
| |
| "green",
| |
| "#ccc123",
| |
| "#345232",
| |
| "#231111",
| |
| "#ab2322"
| |
| ],
| |
| random : function (num){undefined
| |
| return Math.floor(Math.random()*num);
| |
| },
| |
| init : function (num){undefined
| |
| | |
| this.maxlength = num;
| |
| | |
| this.maxWidth = (document.documentElement.clientWidth || document.body.clientWidth) + 20;
| |
| | |
| this.maxHeight = (document.documentElement.clientHeight || document.body.clientHeight) + 20;
| |
| this.create();
| |
| this.move();
| |
| },
| |
| | |
| create : function (){undefined
| |
| var that = this;
| |
| setInterval(function (){undefined
| |
| | |
| if( that.arr.length < that.maxlength){undefined
| |
| var d = document.createElement("div");
| |
| | |
| d.innerHTML = that.snowflake[that.random(that.snowflake.length)];
| |
| d.style.color = that.snowflakeColor[that.random(that.snowflakeColor.length)];
| |
| d.style.position = "absolute";
| |
| | |
| top(0- -99) left (0 - that.maxWidth*2/3-1)
| |
| d.style.left = that.random(that.maxWidth*2/3) + "px";
| |
| d.style.top = -that.random(100) + "px";
| |
| | |
| d.vx = 2+that.random(10);
| |
| d.vy = 3+that.random(10);
| |
| | |
| document.body.appendChild(d);
| |
| that.arr.push(d)
| |
| }
| |
| },20)
| |
| },
| |
| | |
| move : function (){undefined
| |
| var that = this;
| |
| var arr = that.arr;
| |
| setInterval(function (){undefined
| |
| | |
| for(var i = 0 ; i < arr.length ; i ++ ){undefined
| |
| | |
| arr[i].style.left = arr[i].offsetLeft + arr[i].vx + "px";
| |
| arr[i].style.top = arr[i].offsetTop + arr[i].vy + 'px';
| |
| | |
| if (arr[i].offsetTop >= that.maxHeight || arr[i].offsetLeft >= that.maxWidth) {undefined
| |
| document.body.removeChild(arr[i]);
| |
| arr.splice(i,1);
| |
| }
| |
| }
| |
| },30)
| |
| }
| |
| }
| |
| window.onload = function (){undefined
| |
| snowflakes.init(100);
| |
| }
| |