Reveal a picture piece by piece

后端 未结 2 497
一整个雨季
一整个雨季 2021-01-25 03:35

I am trying to reveal a picture piece by piece. I found this thread here need ideas to only display some pixels and gray out the remaining pixels, with an excellent answer from

2条回答
  •  长发绾君心
    2021-01-25 04:39

    You need to change two things.

    First is the size of the grey boxes. That is done with this

    htmlFrag += '
    ';

    Into something like this

    htmlFrag += '
    ';

    Then you need to change the for loop that puts the boxes in to match

    for (var i = 0, len = $('#i').height(); i < len; i += 3) {
        for (var j = 0, len = $('#i').width(); j < len; j += 3) {
    

    Turns into

    for (var i = 0, len = $('#i').height(); i < len; i += 10) {
        for (var j = 0, len = $('#i').width(); j < len; j += 10) {
    

    Here's the example !

提交回复
热议问题