Skip to main content

Javascript FireCracker Animation

  || FireCracker Animation Using JavaScript || 



#CODE : 

                       

                                       
   <!DOCTYPE html>
<html>
<head>
<title>JavaScript FireDesign</title>
<style type="text/css">
body{
background: #000;
margin: 0;
width: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<canvas></canvas>
<script type="text/javascript">
var t =0;
var c = document.querySelector("canvas");
var $ = c.getContext('2d');
c.width = window.innerWidth;
c.height = window.innerHeight;
$.fillStyle = 'hsla(0,0%,0%,1)';

window.addEventListener('resize',function(){
c.width = window.innerWidth;
c.height= window.innerHeight;
},false);

function draw(){
$.globalCompositeOperation = 'source-over';
$.fillStyle = 'hsla(0,0%,0%,.1)';
$.fillRect(0,0,c.width,c.height);
var foo,i,j,r;
foo = Math.sin(t) * 2* Math.PI;
for(i=0;i<400;++i){
r = 400 * Math.sin(i * foo);
$.globalCompositeOperation = '';
$.fillStyle = 'hsla('+i +12 + ',100%,60%,1)';
$.beginPath();
$.arc(Math.sin(i) * r + (c.width/2),
Math.cos(i) * r + (c.height/2),
1.5,0,Math.PI * 2);
$.fill();
}
t += 0.000005;
return t%= 2 * Math.PI;

};
function run(){
window.requestAnimationFrame(run);
draw();
}
run();
</script>
</body>
</html>



  #OUTPUT: 













Comments

The Most Populer

POP UP | ALERT MESSAGE

 || POP UP MESSAGE BOX || ALERT  MESSAGE BOX || CODE BY CODOBLOG || codoblog giving the code for designing the code for POP UP message Box. This box also helpfull for giving the message of alerting also. Design it and use properly in your websites. This pop up message is so helpful for the alerting users during interacting with our web. So, try to do the code for it, and keep connected with the codoblog.   #CODE -         <!DOCTYPE html> <html> <head>   <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title> Pop up</title>     <link rel="stylesheet">     <script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js"></script>     <style type="text/css">     h3{     font-family: lucida Handwriting;     text-ali...

Android Logo Design

                    Android Logo Design By Html-Css                                                                                 Here is the code for designing the logo of Android. Design the logo by using programming language like Html and Css. You can simply design the logo, just small code for it. Don't hasitate and start to write it.. CODE :                 <!DOCTYPE html> <html> <head> <title>Android logo</title> <link href="https://fonts.googleapis.com/css2?family=Piedra&display=swap" rel="stylesheet"> <style type="text/css"> body{ background-color: black; } h4{ text-alig...

The Sticky Flag Animation

The Sticky Flag Animation with Hover Effect               Here is the new animation of the sticky like flag. When the mouse is close or on the object, the flag flip and flop with hover effect and display the text in it.     Try once the code and stay loving codoblog...Happy here.     CODE -             <html> <head>       <style type="text/css">       .animation{       transition:all 750ms ease-in-out;       }       #Awesome{       position: relative;       width: 180px;       height: 180px;       margin:  0 auto;       backface-visibility:hidden;       }       #Awesome .sticky{       transform:rotate(45deg);       }       ...