ដាក់ព្រិលធ្លាក់សម្រាប់លម្អរប្លក់របស់អ្នក ០២

   តើអ្នកចង់លម្អរប្លក់របស់អ្នកឲមានភាពស្រស់ស្អាតដែរឬទេ? ក្នុងគន្លឹះថ្ងៃនេះខ្ញុំនឹងបង្ហាញអំពី របៀបក្នុងការ​ ដាក់ព្រិលធ្លាក់នៅលើប្លក់ ប្រសិនបើអ្នកចូលចិត្តនូវគន្លឹះមួយនេះ តោះ! ទៅរៀនដាក់ ជាមួយខ្ញុំនៅខាងក្រោម ទាំងអស់គ្នា។

១-សូមចូលទៅកាន់គណនីប្លក់របស់អ្នក
២-ចូលទៅកាន់ Theme បន្ទាប់មក Edit HTML
៣-ចម្លងកូដខាងក្រោមដាក់ពីខាងលើ </body>
<style type='text/css'>
.snow{position:fixed;top:0;left:0;right:0;pointer-events:none;z-index:20}
</style>
<canvas id="canvas" class="snow"></canvas>
<script type='text/javascript'>
(function(){'use strict';var canvas,ctx;var points=[];var maxDist=100;function init(){canvas=document.getElementById("canvas");ctx=canvas.getContext("2d");resizeCanvas();generatePoints(700);pointFun();setInterval(pointFun,25);window.addEventListener('resize',resizeCanvas,false);}
function point(){this.x=Math.random()*(canvas.width+maxDist)-(maxDist/2);this.y=Math.random()*(canvas.height+maxDist)-(maxDist/2);this.z=(Math.random()*0.5)+0.5;this.vx=((Math.random()*2)-0.5)*this.z;this.vy=((Math.random()*1.5)+1.5)*this.z;this.fill="rgba(255,255,255,"+((0.5*Math.random())+0.5)+")";this.dia=((Math.random()*2.5)+1.5)*this.z;points.push(this);}
function generatePoints(amount){var temp;for(var i=0;i&lt;amount;i++){temp=new point();};console.log(points);}
function draw(obj){ctx.beginPath();ctx.strokeStyle="transparent";ctx.fillStyle=obj.fill;ctx.arc(obj.x,obj.y,obj.dia,0,2*Math.PI);ctx.closePath();ctx.stroke();ctx.fill();}
function update(obj){obj.x+=obj.vx;obj.y+=obj.vy;if(obj.x&gt;canvas.width+(maxDist/2)){obj.x=-(maxDist/2);}
else if(obj.xpos&lt;-(maxDist/2)){obj.x=canvas.width+(maxDist/2);}
if(obj.y&gt;canvas.height+(maxDist/2)){obj.y=-(maxDist/2);}
else if(obj.y&lt;-(maxDist/2)){obj.y=canvas.height+(maxDist/2);}}
function pointFun(){ctx.clearRect(0,0,canvas.width,canvas.height);for(var i=0;i&lt;points.length;i++){draw(points[i]);update(points[i]);};}
function resizeCanvas(){canvas.width=window.innerWidth;canvas.height=window.innerHeight;pointFun();}
document.addEventListener('DOMContentLoaded',init,false);})();
</script>
៤-ចុចពាក្យ Save Theme។

Comments