Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

5/02/2016

Canvas Clock

Create the Canvas
The clock needs an HTML container. Create an HTML canvas:

The HTML5 < canvas > tag is used to draw graphics, on the fly, via scripting (usually JavaScript).

However, the < canvas> element has no drawing abilities of its own (it is only a container for graphics) - you must use a script to actually draw the graphics.

The getContext() method returns an object that provides methods and properties for drawing on the canvas.

This reference will cover the properties and methods of the getContext("2d") object, which can be used to draw text, lines, boxes, circles, and more - on the canvas.

<!DOCTYPE html>
<html>
<body>

<canvas id="canvas" width="400" height="400"
style="background-color:#333">
</canvas>

<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var radius = canvas.height / 2;
ctx.translate(radius, radius);
radius = radius * 0.90
setInterval(drawClock, 1000);

function drawClock() {
  drawFace(ctx, radius);
  drawNumbers(ctx, radius);
  drawTime(ctx, radius);
}

function drawFace(ctx, radius) {
  var grad;
  ctx.beginPath();
  ctx.arc(0, 0, radius, 0, 2*Math.PI);
  ctx.fillStyle = 'white';
  ctx.fill();
  grad = ctx.createRadialGradient(0,0,radius*0.95, 0,0,radius*1.05);
  grad.addColorStop(0, '#333');
  grad.addColorStop(0.5, 'white');
  grad.addColorStop(1, '#333');
  ctx.strokeStyle = grad;
  ctx.lineWidth = radius*0.1;
  ctx.stroke();
  ctx.beginPath();
  ctx.arc(0, 0, radius*0.1, 0, 2*Math.PI);
  ctx.fillStyle = '#333';
  ctx.fill();
}

function drawNumbers(ctx, radius) {
  var ang;
  var num;
  ctx.font = radius*0.15 + "px arial";
  ctx.textBaseline="middle";
  ctx.textAlign="center";
  for(num = 1; num < 13; num++){
    ang = num * Math.PI / 6;
    ctx.rotate(ang);
    ctx.translate(0, -radius*0.85);
    ctx.rotate(-ang);
    ctx.fillText(num.toString(), 0, 0);
    ctx.rotate(ang);
    ctx.translate(0, radius*0.85);
    ctx.rotate(-ang);
  }
}

function drawTime(ctx, radius){
    var now = new Date();
    var hour = now.getHours();
    var minute = now.getMinutes();
    var second = now.getSeconds();
    //hour
    hour=hour%12;
    hour=(hour*Math.PI/6)+
    (minute*Math.PI/(6*60))+
    (second*Math.PI/(360*60));
    drawHand(ctx, hour, radius*0.5, radius*0.07);
    //minute
    minute=(minute*Math.PI/30)+(second*Math.PI/(30*60));
    drawHand(ctx, minute, radius*0.8, radius*0.07);
    // second
    second=(second*Math.PI/30);
    drawHand(ctx, second, radius*0.9, radius*0.02);
}

function drawHand(ctx, pos, length, width) {
    ctx.beginPath();
    ctx.lineWidth = width;
    ctx.lineCap = "round";
    ctx.moveTo(0,0);
    ctx.rotate(pos);
    ctx.lineTo(0, -length);
    ctx.stroke();
    ctx.rotate(-pos);
}
</script>

</body>
</html>


12/10/2015

How to install "Back to the Top" button with smooth scrolling

This is really  great thing for the long posts, articles or whatever you have on your blog / website so this is really more than helpful and so easy to integrate into the system, at least in blogger will not be a problem, or any other platform because it works on jQuery system so it's everything in perfect order.


The role and function of the button back to top itself is quite important that makes it easy for visitors who want to go back to the top of the page mengscroll by simply clicking a button. Note: If an existing template back to top button, please remove it first.
So let's start and finish very quickly:


Log in to Blogger, then click the Edit HTML, save the following code after the <head> or before </head> tag.

<link href='//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css' rel='stylesheet'/>

If fontawesome already added in your template then ignore it.

2 - Save the below css before ]]></b:skin> or </style>CSS
.smoothscroll-top {
    position:fixed;
    opacity:0;
    visibility:hidden;
    overflow:hidden;
    text-align:center;
    z-index:99;
    background-color:#2ba6e1;
    color:#fff;
    width:47px;
    height:44px;
    line-height:44px;
    right:25px;
    bottom:-25px;
    padding-top:2px;
    border-radius:5px;
    transition:all 0.5s ease-in-out;
    transition-delay:0.2s;
}
.smoothscroll-top:hover {
    background-color:#3eb2ea;
    color:#fff;
    transition:all 0.2s ease-in-out;
    transition-delay:0s;
}
.smoothscroll-top.show {
    visibility:visible;
    cursor:pointer;
    opacity:1;
    bottom:25px;
}
.smoothscroll-top i.fa {
    line-height:inherit;
}

3 - Save the below JQuery and HTML before </body>Tag
<div class="smoothscroll-top">
    <span class="scroll-top-inner">
        <i class="fa fa-2x fa-arrow-circle-up"></i>
    </span>
</div>
<script type='text/javascript'>
//<![CDATA[
$(function(){

    $(document).on( 'scroll', function(){

        if ($(window).scrollTop() > 100) {
            $('.smoothscroll-top').addClass('show');
        } else {
            $('.smoothscroll-top').removeClass('show');
        }
    });

    $('.smoothscroll-top').on('click', scrollToTop);
});

function scrollToTop() {
    verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;
    element = $('body');
    offset = element.offset();
    offsetTop = offset.top;
    $('html, body').animate({scrollTop: offsetTop}, 600, 'linear').animate({scrollTop:25},200).animate({scrollTop:0},150) .animate({scrollTop:0},50);
}
//]]>
</script>

There you go... Just add these codes and that's it. If you have a problem, leave a comment. If you like, please Like, share, etc...

7/03/2015

Subscribe Box For Blogger And WordPress


The subscribe box uses pure HTML5 and CSS3 effects to enhance its look. 
Compatibility:
The widget is supported (with effects) in all popular browsers:
Subscribe Box For Blogger And WordPress  in all popular browsers

Blogger:

The installation of this subscribe box is quite easy. Just follow these steps for Blogger
  • Go to Blogger > Layout 
  • Click on Add A New Widget > HTML/Javascript 
  • Paste the following code in the box:

Replace ekWMe with your feedburner feed ID.


WordPress:
  • Go to WordPress Admin > Appearance.
  • Drag a text widget.
  • Paste the following content in it:

- Replace MPT-Network with your feedburner feed ID
- Done! Check your site and you won't be disappointed with the results!

5/31/2015

PERTAMAX !!

PERTAMAX!! - Responsive HTML5 Blogger Templates is perfect For Personal Blogs Sites, Modern and fully responsive (try resizing your browser), And PERTAMAX!! - Responsive HTML5 Looks Cool and more.






Similar Template:  Tokyo Gahoel
Author: Kang Rian


5/15/2015

WP Eco Spa

Free Template  impressive design, color matching Spa with a combination of color harmony, the theme will bring a dramatic look to the viewer. Moreover, the themes are designed with a clean, flat grid system based on the use of media queries inline CSS,HTML5, which makes the development of the site easier to meet and work on mobile devices better.





Wordpress Theme