zoukankan      html  css  js  c++  java
  • three.js 相机跟随鼠标移动

    相机跟随鼠标移动

    代码

    var startY,endY;
            var isDown = false;
            var changeBefore = 0;
            function addTouchListener() {
                document.onmousedown = function (event) {
                    startY = event.clientY;
                    isDown = true;
                };
                document.onmouseup = function(event){
                    isDown = false;
                };
                document.onmousemove = function (event) {
                    if (isDown) {
                        if(changeBefore != 0){
                            if(changeBefore > event.clientY){
                                camera.position.y = camera.position.y + 20;
                            }else{
                                camera.position.y = camera.position.y - 20;
                            }
                        }
                        endY = event.clientY;
                        changeBefore = endY;
                    }
                };
            }
  • 相关阅读:
    洛谷P1272 重建道路
    uva 10004
    uva10305
    uva 10044
    uva 120
    uva699
    uva297
    uva11111
    uva 101
    uva10152 ShellSort
  • 原文地址:https://www.cnblogs.com/chenyi4/p/12465743.html
Copyright © 2011-2022 走看看