javascript - Image gathering effect, plus 3D effect, why are there lines after gathering?
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-18 10:46:23
0
1
540

There are many sub-p's in one p, and the background images of the sub-p's are combined to form a whole picture; for the gathering effect, I added a 3D y-axis inversion effect. Why is there a small gap in the middle when splicing?
Press Logically speaking, it should be like this after gathering

The result is like this

Attached code
.pic{width: 1000px;height: 655px;position: absolute;left: 0;right: 0;top: 0;bottom: 0;margin: auto;background: tan;transform- style: preserve-3d;perspective: 500px;}

    .item{position: absolute;}

<p class="pic"></p>
<script>

for (var i=0;i<240;i++){
    $('<p class="item"></p>').css({
        'width':1000/24+'px',
        'height':655/10+'px',
        'background-image':'url(images/meinv.jpg)'
    }).appendTo('.pic');
}
$('.item').each(function(index){
    var x=index%24;
    var y=parseInt(index/24);
    var randomX=Math.random()*800-400;
    var randomY=Math.random()*800-400;
    $(this).css({'background-position':-x*(1000/24)+"px "+-y*(655/10)+"px",'left':x*(1000/24),'top':y*(655/10), 'transform':"translate("+x*randomX+"px,"+y*randomY+"px) rotate(360deg) scale(0.2) "}).hide()
});
var bol=true;
$('.pic').click(function (){
    if (bol) {
        $('.item').each(function(){
        var random=Math.random()*3+2;
        $(this).fadeIn().css({'transform':'translate(0) rotate(0deg) scale(1) ','transition':'all '+random+'s ease-in-out'})
        })
    }else{
        console.log(1)
        $('.item').each(function(index){
            var x=index%24;
            var y=parseInt(index/24);
            var randomX=Math.random()*800-400;
            var randomY=Math.random()*800-400;
            $(this).css({'left':x*(1000/24),'top':y*(655/10), 'transform':"translate("+x*randomX+"px,"+y*randomY+"px) rotate(360deg) scale(0.2) rotateY(180deg)"}).fadeOut()
        })
    }
    bol=!bol
})

</script>

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
淡淡烟草味

Make sure the browser view is not zoomed in! ctrl + 0 try.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template