Showing posts with label animation in CSS. Show all posts
Showing posts with label animation in CSS. Show all posts

7 Nov 2016

Recreational Coding with HTML (Leisure Activity)

Code:

 <!-----------------------------------------------  
 Author: Qaidjohar  
 Date Created: Nov 7 2016  
 Logical Comment: Leisure Activity  
 ------------------------------------------------>  
   
 <html>  
   <head>  
     <title>Mario</title>  
     <style type="text/css">  
       *  
       {  
         margin: 0px;  
         padding: 0px;  
       }  
       .main  
       {  
         width:1000px;  
         margin-left: 183px;  
       }  
       .header  
       {  
         background-color: greenyellow;  
         height: 50px;  
       }  
       .container  
       {  
         background-color: darkseagreen;  
       }  
       .footer  
       {  
         background-color: black;  
         height: 25px;  
       }  
       td  
       {  
         height: 20px;  
         width: 20px;  
         background-color: darkseagreen;  
       }  
       h1  
       {  
         text-align: center;  
         color: green;  
         font-style: oblique;  
         line-height: 50px;  
       }  
       h4  
       {  
         color: yellow;  
         text-align: center;  
         line-height: 25px;  
       }  
       .mario  
       {  
         animation: mario-anim 10s infinite;  
       }  
       .red  
       {  
         background-color: red;  
       }  
       .yellow  
       {  
         background-color: yellow;  
       }  
       .brown  
       {  
         background-color: saddlebrown;  
       }  
       .black  
       {  
         background-color: black;  
       }  
       .blue  
       {  
         background-color: blue;  
       }  
       @keyframes mario-anim  
       {  
         50%{margin-left: 720px;}  
         100%{margin-left: 0px;}  
       }  
     </style>  
   </head>  
     
   <body>  
     <div class="main">  
       <div class="header">  
         <h1>Recreational Coding with HTML</h1>  
       </div>  
       <div class="container">  
         <div class="mario">  
           <table cellspacing="0" cellpadding="0">  
             <!-- 1 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class=""></td> <!-- 4 -->  
               <td class=""></td> <!-- 5 -->  
               <td class=""></td> <!-- 6 -->  
               <td class=""></td> <!-- 7 -->  
               <td class=""></td> <!-- 8 -->  
               <td class=""></td> <!-- 9 -->  
               <td class=""></td> <!-- 10 -->  
               <td class=""></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 2 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class=""></td> <!-- 4 -->  
               <td class="red"></td> <!-- 5 -->  
               <td class="red"></td> <!-- 6 -->  
               <td class="red"></td> <!-- 7 -->  
               <td class="red"></td> <!-- 8 -->  
               <td class="red"></td> <!-- 9 -->  
               <td class=""></td> <!-- 10 -->  
               <td class=""></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 3 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class="red"></td> <!-- 4 -->  
               <td class="red"></td> <!-- 5 -->  
               <td class="red"></td> <!-- 6 -->  
               <td class="red"></td> <!-- 7 -->  
               <td class="red"></td> <!-- 8 -->  
               <td class="red"></td> <!-- 9 -->  
               <td class="red"></td> <!-- 10 -->  
               <td class="red"></td> <!-- 11 -->  
               <td class="red"></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 4 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class="brown"></td> <!-- 4 -->  
               <td class="brown"></td> <!-- 5 -->  
               <td class="brown"></td> <!-- 6 -->  
               <td class="yellow"></td> <!-- 7 -->  
               <td class="yellow"></td> <!-- 8 -->  
               <td class="black"></td> <!-- 9 -->  
               <td class="yellow"></td> <!-- 10 -->  
               <td class=""></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 5 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class="brown"></td> <!-- 3 -->  
               <td class="yellow"></td> <!-- 4 -->  
               <td class="brown"></td> <!-- 5 -->  
               <td class="yellow"></td> <!-- 6 -->  
               <td class="yellow"></td> <!-- 7 -->  
               <td class="yellow"></td> <!-- 8 -->  
               <td class="black"></td> <!-- 9 -->  
               <td class="yellow"></td> <!-- 10 -->  
               <td class="yellow"></td> <!-- 11 -->  
               <td class="yellow"></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 6 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class="brown"></td> <!-- 3 -->  
               <td class="yellow"></td> <!-- 4 -->  
               <td class="brown"></td> <!-- 5 -->  
               <td class="brown"></td> <!-- 6 -->  
               <td class="yellow"></td> <!-- 7 -->  
               <td class="yellow"></td> <!-- 8 -->  
               <td class="yellow"></td> <!-- 9 -->  
               <td class="black"></td> <!-- 10 -->  
               <td class="yellow"></td> <!-- 11 -->  
               <td class="yellow"></td> <!-- 12 -->  
               <td class="yellow"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 7 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class="brown"></td> <!-- 4 -->  
               <td class="yellow"></td> <!-- 5 -->  
               <td class="yellow"></td> <!-- 6 -->  
               <td class="yellow"></td> <!-- 7 -->  
               <td class="yellow"></td> <!-- 8 -->  
               <td class="black"></td> <!-- 9 -->  
               <td class="black"></td> <!-- 10 -->  
               <td class="black"></td> <!-- 11 -->  
               <td class="black"></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 8 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class=""></td> <!-- 4 -->  
               <td class="yellow"></td> <!-- 5 -->  
               <td class="yellow"></td> <!-- 6 -->  
               <td class="yellow"></td> <!-- 7 -->  
               <td class="yellow"></td> <!-- 8 -->  
               <td class="yellow"></td> <!-- 9 -->  
               <td class="yellow"></td> <!-- 10 -->  
               <td class=""></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 9 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class="red"></td> <!-- 4 -->  
               <td class="red"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class="red"></td> <!-- 7 -->  
               <td class="red"></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="red"></td> <!-- 10 -->  
               <td class="red"></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 10 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class="red"></td> <!-- 3 -->  
               <td class="red"></td> <!-- 4 -->  
               <td class="red"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class="red"></td> <!-- 7 -->  
               <td class="red"></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="red"></td> <!-- 10 -->  
               <td class="red"></td> <!-- 11 -->  
               <td class="red"></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 11 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class="red"></td> <!-- 2 -->  
               <td class="red"></td> <!-- 3 -->  
               <td class="red"></td> <!-- 4 -->  
               <td class="red"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class="blue"></td> <!-- 7 -->  
               <td class="blue"></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="red"></td> <!-- 10 -->  
               <td class="red"></td> <!-- 11 -->  
               <td class="red"></td> <!-- 12 -->  
               <td class="red"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 12 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class="yellow"></td> <!-- 2 -->  
               <td class="yellow"></td> <!-- 3 -->  
               <td class="red"></td> <!-- 4 -->  
               <td class="blue"></td> <!-- 5 -->  
               <td class="yellow"></td> <!-- 6 -->  
               <td class="blue"></td> <!-- 7 -->  
               <td class="blue"></td> <!-- 8 -->  
               <td class="yellow"></td> <!-- 9 -->  
               <td class="blue"></td> <!-- 10 -->  
               <td class="red"></td> <!-- 11 -->  
               <td class="yellow"></td> <!-- 12 -->  
               <td class="yellow"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 13 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class="yellow"></td> <!-- 2 -->  
               <td class="yellow"></td> <!-- 3 -->  
               <td class="yellow"></td> <!-- 4 -->  
               <td class="blue"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class="blue"></td> <!-- 7 -->  
               <td class="blue"></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="blue"></td> <!-- 10 -->  
               <td class="yellow"></td> <!-- 11 -->  
               <td class="yellow"></td> <!-- 12 -->  
               <td class="yellow"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 14 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class="yellow"></td> <!-- 2 -->  
               <td class="yellow"></td> <!-- 3 -->  
               <td class="blue"></td> <!-- 4 -->  
               <td class="blue"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class="blue"></td> <!-- 7 -->  
               <td class="blue"></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="blue"></td> <!-- 10 -->  
               <td class="blue"></td> <!-- 11 -->  
               <td class="yellow"></td> <!-- 12 -->  
               <td class="yellow"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 15 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class="blue"></td> <!-- 4 -->  
               <td class="blue"></td> <!-- 5 -->  
               <td class="blue"></td> <!-- 6 -->  
               <td class=""></td> <!-- 7 -->  
               <td class=""></td> <!-- 8 -->  
               <td class="blue"></td> <!-- 9 -->  
               <td class="blue"></td> <!-- 10 -->  
               <td class="blue"></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 16 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class="brown"></td> <!-- 3 -->  
               <td class="brown"></td> <!-- 4 -->  
               <td class="brown"></td> <!-- 5 -->  
               <td class=""></td> <!-- 6 -->  
               <td class=""></td> <!-- 7 -->  
               <td class=""></td> <!-- 8 -->  
               <td class=""></td> <!-- 9 -->  
               <td class="brown"></td> <!-- 10 -->  
               <td class="brown"></td> <!-- 11 -->  
               <td class="brown"></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 17 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class="brown"></td> <!-- 2 -->  
               <td class="brown"></td> <!-- 3 -->  
               <td class="brown"></td> <!-- 4 -->  
               <td class="brown"></td> <!-- 5 -->  
               <td class=""></td> <!-- 6 -->  
               <td class=""></td> <!-- 7 -->  
               <td class=""></td> <!-- 8 -->  
               <td class=""></td> <!-- 9 -->  
               <td class="brown"></td> <!-- 10 -->  
               <td class="brown"></td> <!-- 11 -->  
               <td class="brown"></td> <!-- 12 -->  
               <td class="brown"></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
   
             <!-- 18 -->  
             <tr>  
               <td class=""></td> <!-- 1 -->  
               <td class=""></td> <!-- 2 -->  
               <td class=""></td> <!-- 3 -->  
               <td class=""></td> <!-- 4 -->  
               <td class=""></td> <!-- 5 -->  
               <td class=""></td> <!-- 6 -->  
               <td class=""></td> <!-- 7 -->  
               <td class=""></td> <!-- 8 -->  
               <td class=""></td> <!-- 9 -->  
               <td class=""></td> <!-- 10 -->  
               <td class=""></td> <!-- 11 -->  
               <td class=""></td> <!-- 12 -->  
               <td class=""></td> <!-- 13 -->  
               <td class=""></td> <!-- 14 -->  
             </tr>  
           </table>  
         </div>  
       </div>  
       <div class="footer">  
         <h4>Keep Calm and Love Open Source</h4>   
       </div>  
     </div>  
   </body>  
 </html>  

Output:


13 Sept 2016

Animation in HTML using CSS

HTML Code:


 <!----------------------------------------------  
 Author: Qaidjohar  
 Creation Date: 13/09/16  
 Logical Comment: Animation Using CSS - HTML file  
 ----------------------------------------------->  
   
 <html>  
 <head>  
 <title>Animation using CSS</title>  
 <link rel="stylesheet" type="text/css" href="html_animation_post.css">  
 </head>  
     
 <body>  
 <!-------------------main div---------------------------->  
 <div class="main">  
     
 <!-------------------header div---------------------------->  
 <div class="header">  
 <h1>Animation in HTML using CSS</h1>  
 </div>  
     
 <!-------------------container div---------------------------->  
 <div class="container">  
 <div class="go">  
   <svg height="100%" width="100%">  
     <rect height="100px" width="10px" x="55" y="250" fill="black"/>  
     <polygon points="20,210 30,200 100,200 110,210 110,240 100,250 30,250 20,240" fill="white" stroke="black" stroke-width="2px"/>  
     <polygon points="30,220 80,220 80,210 100,225 80,240 80,230 30,230" fill="red"/>  
   </svg>  
 </div>  
     
 <div class="ball">  
   <svg height="120px" width="120px">  
     <circle cx="60" cy="60" r="58px" fill="yellow" stroke="darkorange" stroke-width="3px"/>  
     <circle cx="80" cy="40" r="12px" fill="black"/>  
     <ellipse rx="4px" ry="5px" cx="85" cy="40" fill="grey"/>  
     <ellipse rx="30px" ry="8px" cx="80" cy="90" fill="pink" stroke="darkorange" stroke-width="2px"/>  
   </svg>  
 </div>  
     
 <div class="road">  
   <svg height="50px" width="100%">  
     <rect height="40px" width="127px" x="13" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>   
     <rect height="40px" width="140px" x="150" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>  
     <rect height="40px" width="140px" x="300" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>   
     <rect height="40px" width="140px" x="450" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>  
     <rect height="40px" width="140px" x="600" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>  
     <rect height="40px" width="140px" x="750" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>  
     <rect height="40px" width="140px" x="900" y="0" fill="brown" stroke="darkred" stroke-width="3px"/>   
   </svg>  
 </div>  
 </div>  
     
 <!-------------------footer div---------------------------->  
 <div class="footer">  
 <h3>(: Keep calm and love Open Source :)</h3>  
 </div>  
 </div>  
 </body>  
 </html>  

CSS code:


 /**********************************************  
 Author: Qaidjohar  
 Creation Date: 13/09/16  
 Logical Comment: Animation Using CSS - CSS file  
 **********************************************/  
   
 *  
 {  
      margin:0px;  
      padding:0px;  
 }  
   
 .main  
 {  
      height:550px;  
      width:1000px;  
   margin-left: 183px;  
 }  
   
 .header  
 {  
      height:100px;  
      width:100%;  
      background-color:chocolate;  
 }  
   
 h1  
 {  
      color:aqua;  
      text-align:center;  
      line-height:100px;  
 }  
   
 .container  
 {  
      height:400px;  
      width:100%;  
      background-color:burlywood;  
 }  
   
 .go   
 {  
   height: 400px;  
   width: 130px;  
   float: left;  
 }  
   
 .ball  
 {  
   height: 120px;  
   width: 120px;  
   position: absolute;  
   margin-top: 230px;  
   margin-left: 200px;  
   animation: animBall 1.5s infinite;  
 }  
   
 .road  
 {  
   height: 50px;  
   width: 1000px;  
   position: absolute;  
   margin-top: 350px;  
   animation: animRoad 0.5s infinite;  
 }  
   
 .footer  
 {  
      height:50px;  
      width:100%;  
      background-color:chocolate;  
 }  
   
 h3  
 {  
      text-align:center;  
      line-height:50px;  
   color:darkred;  
 }  
   
 @keyframes animRoad  
 {  
   100% {margin-left: -10px;}    
 }  
   
 @keyframes animBall  
 {  
   25%{margin-left: 300px;margin-top: 130px; transform: rotate(90deg);}  
   50%{margin-left: 400px;margin-top: 30px; transform: rotate(180deg);}  
   75%{margin-left: 500px;margin-top: 130px; transform: rotate(270deg);}  
   100%{margin-left: 600px;margin-top: 230px; transform: rotate(360deg);}  
 }  

Output:


23 Aug 2016

Scalar Vector Graphics

Using SVG tag in HTML, one can draw various shapes like rectangle, circle, ellipse and polygon in web page. Below is one demonstration of SVG tag including HTML file, CSS file and output image:

HTML File:


 <!----------------------------------  
 Author: Qaidjohar  
 Creation Date: Aug 23,2016  
 Logical Comment: HTML file for SVG Demo  
 ----------------------------------->  
   
 <html>  
 <head>  
 <title>SVG Demo</title>  
 <link rel="stylesheet" type="text/css" href="../css/blog_svg.css">  
 </head>  
 <body>  
 <!-------------------------Main Div-------------------------------->  
 <div class="main">  
 <!-------------------------Header Div------------------------------>  
 <div class="header">  
 <h1>Scalar Vector Graphics</h1>  
 </div>  
 <!-------------------------Container Div--------------------------->  
 <div class="container">  
 <svg height=100% width=100%>  
 <!----------------------Mountain and Sun--------------------------->  
 <polygon points="0,500 125,250 250,500" fill="brown" stroke="orange" stroke-width="3px"/>  
 <circle cx="365" cy="322" r="50px" fill="yellow"/>  
 <polygon points="187,375 250,250 375,375 312,500 250,500" fill="brown" stroke="orange" stroke-width="3px"/>  
 <polygon points="312,500 437,250 500,500" fill="brown" stroke="orange" stroke-width="3px"/>  
 <!-------------------------House----------------------------------->  
 <rect height="125px" width="60px" x="625" y="375" fill="cyan" stroke="black" stroke-width="2px"/>  
 <rect height="125px" width="190px" x="685" y="375" fill="cyan" stroke="black" stroke-width="2px"/>  
 <polygon points="625,375 655,312 685,375" fill="pink" stroke="black" stroke-width="2px"/>  
 <circle cx="655" cy="353" r="13px" fill="black"/>  
 <ellipse rx="5px" ry="8px" cx="662" cy="353" fill="grey"/>  
 <polygon points="655,312 845,312 875,375 685,375" fill="pink" stroke="black" stroke-width="2px"/>  
 <rect height="50px" width="30px" x="640" y="450" fill="grey" stroke="black" stroke-width="2px"/>  
 <rect height="25px" width="25px" x="720" y="410" fill="grey" stroke="black" stroke-width="2px"/>  
 <rect height="25px" width="25px" x="805" y="410" fill="grey" stroke="black" stroke-width="2px"/>  
 <!-------------------------Tree------------------------------------>  
 <rect height="63px" width="25px" x="927" y="437" fill="brown"/>  
 <polygon points="900,437 937,400 980,437" fill="green"/>  
 <polygon points="900,417 937,380 980,417" fill="green"/>  
 <polygon points="900,395 937,355 980,395" fill="green"/>  
 </svg>  
 </div>  
 <!-------------------------Footer Div-------------------------------->  
 <div class="footer">  
 <p>(: Open Source :)</p>  
 </div>  
 </div>  
 </body>  
 </html>  
   

CSS File:


 /*  
 Author: Qaidjohar  
 Creation Date: Aug 23,2016  
 Logical Comment: CSS file for SVG Demo  
 */  
   
 *  
 {  
      margin:0px;  
      padding:0px;  
 }  
   
 body  
 {  
      background-color:pink;  
 }  
 .main  
 {  
      height:650px;  
      width:1000px;  
      margin-left:183px;  
 }  
   
 .header  
 {  
      height:100px;  
      width:1000px;  
      background-color:black;  
 }  
   
 h1  
 {  
      color:yellow;  
      text-align:center;  
      line-height:90px;  
 }  
   
 .container  
 {  
      height:500px;  
      width:1000px;  
        
 }  
   
 svg  
 {  
      background-color:#AAAAFF;  
 }  
   
 .footer  
 {  
      height:50px;  
      width:1000px;  
      background-color:grey;  
 }  
   
 p  
 {  
      color:white;  
      text-align:center;  
      line-height:50px;  
      font-size:20px;  
 }  

Output: