Question

Does anyone know a way to create a flickering effect? like in Japanese horror movies, when the screen goes bzzz bzzz and it flickers.

I didn't find anything on the web. A link, tutorial - anything would be useful.

Was it helpful?

Solution

I made a fiddle for you, not sure why people are downvoting the question. This is just one solution, adding and removing a CSS class with display:hidden;. Click the picture to begin flashing, you can adjust the flashing speed by adjusting the 300 in the math.random variable, lower is faster.

http://jsfiddle.net/seano666/tDWme/1/

function flash(){
    var del = Math.floor((Math.random()*300)+50);
    $('#kitten').toggleClass("display").delay(del);
    $('#kitten').promise().done(function(){
        flash();
    });
}

EDIT: Added some sound effects to the fiddle, good fun!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top