MouseOver CSS3D effect with javascript

瘦欲@ 提交于 2019-12-03 12:13:39

I Solved the problem. Problem was with not updating vertices value to the original on mouseout event. to revert vertices value to original question i have to keep extra value of vertices like this.

var l = {
                x: Math.floor(i % c) * 284,
                y: Math.floor(i / c) * 284,
                x2: Math.floor(i % c) * 284,
                y2: Math.floor(i / c) * 284,

            };

On mouseover change the vertice value like this for every coordinate

 TweenMax.to(p1, .3, {
                        x: p1.x2 + d,
                        y: p1.y2 - d,
                        ease: Back.easeOut
                    })

and on mouseout reset original position

 TweenMax.to(p2, .3, {
                        x: p2.x,
                        y: p2.y,
                        ease: Back.easeOut
                    })

Do you have this working for a flexible number of columns. Currently it only seems to work for 4!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!