国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

javascript - why two elements are needed to create a scrolling effect with transform
滿天的星座
滿天的星座 2017-05-19 10:18:02
0
2
944

I read other people’s articles why it is necessary to use two layers of elements to perform two animations to achieve the parabolic effect of a small ball, instead of just writing one element<p class="ball"></p>? Then Use transform to modify the x and y axes. I found that writing this way has no effect? But why?

This is someone else’s code

This is my code

beforeDrop(el){
                //把使用到的小球從起始位置(購物車位置)上升到添加按鈕位置
                let count=this.balls.length;
                while(count--){
                    let ball=this.balls[count];
                    if(ball.show){
                        let rect=ball.el.getBoundingClientRect();
                        let y=-(window.innerHeight-rect.top-25)
                        let x=rect-rect.left-32
                        el.style.webkitTransform=`translate3d(${x}px,${y}px,0)`;
                        el.style.transform=`translate3d(${x}px,${y}px,0)`;
                        el.style.display="";
                    }
                }
            },
            dropping(el,done){
                let height=el.offsetHeight//觸發(fā)重繪
                this.$nextTick(()=>{
                    el.style.webkitTransform='translate3d(0,0,0)';
                    el.style.transform='translate3d(0,0,0)';
                    el.addEventListener('transitionend', done); //Vue為了知道過渡的完成,必須設置相應的事件監(jiān)聽器。

                })
            },
            afterDrop(el){
                let ball=this.dropballs.shift();
                if(ball){
                    ball.show=false;
                    el.style.display="none"
                }
                
            },

css:

.ball-container{
            .ball{
                position: fixed;
                z-index: 50;
                width: 12px;
                height: 12px;
                left:32px;
                bottom:25px;
                background: rgb(0, 160, 220);
                border-radius: 50%;
                transition:3.6s all cubic-bezier(0.49, -0.29, 0.75, 0.41)
            }
        }

    

Article address
/a/11...

滿天的星座
滿天的星座

reply all(2)
給我你的懷抱

I noticed a problem at first glance

el.style.webkitTransform=`translate3d(${x}px`,`${y}px,0)`;
el.style.transform=`translate3d(${x}px`,`${y}px,0)`;

You only return the first half here, the whole is a string

el.style.webkitTransform=`translate3d(${x}px,${y}px,0)`;
el.style.transform=`translate3d(${x}px,${y}px,0)`;
過去多啦不再A夢

transition:0.6s all cubic-bezier(0.49, -0.29, 0.75, 0.41) where cubic-bezier is the movement rate, so just writing one will turn into a diagonal animation without a parabola effect. Two elements are actually Equivalent to decomposing speed

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