Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make an image blink?

I was wondering how to make an image blink in CSS, if it is possible. I want to have it blink where it is.

I would also like to change the speed but mainly I want to make it blink.

like image 845
user1623495 Avatar asked Aug 24 '12 19:08

user1623495


People also ask

What is the app that makes pictures blink?

Deep Nostalgia™ uses deep learning algorithms, to produce remarkable results. You can animate any of the faces in your photos to see them move, blink, and smile.

How do I make an image blink in HTML?

You can add the . blink class to any HTML element to make it blink.


2 Answers

CSS animations to the rescue!

@keyframes blink {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}
img {
    animation: blink 1s;
    animation-iteration-count: infinite;
}

http://jsfiddle.net/r6dje/

You can make it a sharp blink by adjusting the intervals:

@keyframes blink {
    0% {
        opacity: 1;
    }
    49% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

http://jsfiddle.net/xtJF5/1/

like image 81
Waleed Khan Avatar answered Oct 05 '22 08:10

Waleed Khan


use setInterval method of Javascript use it as a reference of W3Schools and then change the css from visibility:visible to visiblity:hidden we will not use display:none as it will remove the space of the image as well but we do need the space for the image for the blinking thing to work.

like image 37
Dhruvenkumar Shah Avatar answered Oct 05 '22 08:10

Dhruvenkumar Shah