zoukankan      html  css  js  c++  java
  • arcgis中goto的用法

    1.默认方式(在进行定位导航操作时不设置任何动画)

    shiftCamera(60)代表旋转60度如果需要跳转至指定位置,即可将注释部分放入到goto语句中。下面都是类似的

    document.getElementById("default").addEventListener("click", () => {
                view.goTo(shiftCamera(60)).catch(catchAbortError);
    
            //   {
            //         position: {
            //           x: 13.4,
            //           y: 52.52,
            //           z: 700000,
            //           spatialReference: {
            //             wkid: 4326
            //           }
            //         },
            //         heading: 0,
            //         tilt: 0
            //       },
            });

    2.缓慢移动

    document.getElementById("linearSlow").addEventListener("click", () => {
              view
                .goTo(
                  shiftCamera(60),
                  // Animation options for a slow linear camera flight
                  {
                    speedFactor: 0.1,
                    easing: "linear"
                  }
                )
                .catch(catchAbortError);
            });

    3.快速移动

     

     document.getElementById("linearFast").addEventListener("click", () => {
              view
                .goTo(
                  shiftCamera(60),
                  // Animation options for a fast linear camera flight
                  {
                    speedFactor: 6,
                    easing: "linear"
                  }
                )
                .catch(catchAbortError);
            });

     

    4.逐渐加快

     

     

     document.getElementById("expoIncrease").addEventListener("click", () => {
              view
                .goTo(
                  shiftCamera(60),
                  // Animation options for a camera flight with an increasing speed
                  {
                    duration: 4000,
                    easing: "in-expo"
                  }
                )
                .catch(catchAbortError);
            });

     

    5.在固定时间移动

     

    document.getElementById("fixedDuration").addEventListener("click", () => {
              view
                .goTo(shiftCamera(30), {
                  duration: 10000,
                  maxDuration: 10000 // Make sure to set maxDuration if the duration is bigger than 8000 ms
                })
                .catch(catchAbortError);
            });

     

    6.跳转至相应位置,并产生摆动的效果

     

     function customEasing(t) {
              return 1 - Math.abs(Math.sin(-1.7 + t * 4.5 * Math.PI)) * Math.pow(0.5, t * 10);
            }
    
            document.getElementById("bounceBerlin").addEventListener("click", () => {
              view
                .goTo(
                  {
                    position: {
                      x: 13.4,
                      y: 52.52,
                      z: 700000,
                      spatialReference: {
                        wkid: 4326
                      }
                    },
                    heading: 0,
                    tilt: 0
                  },
                  {
                    speedFactor: 0.3,
                    easing: customEasing
                  }
                )
                .catch(catchAbortError);
            });

     

     

     

     

     

     

     

     

  • 相关阅读:
    Javascript函数声明和函数表达式
    浅谈getAttribute兼容性
    js数组去重的三种常用方法总结
    说说JSON和JSONP,也许你会豁然开朗
    web安全之跨站请求伪造
    javascript中对象的深度克隆
    三种方式实现元素水平居中显示与固定布局和流式布局概念理解
    js dom element 属性整理(原创)
    ul下的li浮动,如何是ul有li的高度
    js数组去重的4个方法
  • 原文地址:https://www.cnblogs.com/1gaoyu/p/15167552.html
Copyright © 2011-2022 走看看