0

How can I make this slider automatically zoom-in and zoom-out for each image without clicking the image in an interval time?

http://www.dhteumeuleu.com/in-second-lives

Please give some idea of how to start this.

 setTimeout(         
        function() { 
         if (camera.over) {
                if (camera.over === camera.target.elem) {
                    camera.target.elem = camera.over;
                    camera.target.x = 50;
                    camera.target.z = 1500;
                    camera.target.x = 0;
                    camera.target.z = 0;
                    camera.target.elem = false;
                    // ---- adapt tesselation level to distance ----
                    for (var i = 0, d; d = diapo[i++];) {
                        var dx = camera.target.x - d.pc.x;
                        var dz = camera.target.z - d.pc.z;
                        var dist = Math.sqrt(dx * dx + dz * dz);
                        var lev = (dist > 1500) ? quality[0] : quality[1];
                        d.img.setLevel(lev);
                    }

                    camera.target.x = 100;
                    camera.target.z = 200;
                    camera.target.elem = false;

                    return ;
                    } else {
                    // ---- goto diapo ----
                    camera.target.elem = camera.over;
                    camera.target.x = camera.over.tx;
                    camera.target.z = camera.over.tz;
                    // ---- adapt tesselation level to distance ----
                    for (var i = 0, d; d = diapo[i++];) {
                        var dx = camera.target.x - d.pc.x;
                        var dz = camera.target.z - d.pc.z;
                        var dist = Math.sqrt(dx * dx + dz * dz);
                        var lev = (dist > 1500) ? quality[0] : quality[1];
                        d.img.setLevel(lev);
                    }
                }
             }
        }
,10000); 

Thanks

4

1 回答 1

0

好的,所以这里有一个建议。我不会给你完整的代码,但这个想法应该足够了:

查看源代码中tap()函数的代码。这是处理相机“放大、缩小、平移和移动”的功能。所以现在,tap()只有当您在图像上单击鼠标按钮时才会调用该函数。tap您可以在函数中使用 setTimeoutrun()来进行自动缩放,而不是等待指针。

关键是pointerrun功能。和他们一起玩,你会偶然发现解决方案。

于 2013-08-05T16:30:42.673 回答