天天看點

Pannellum:執行個體之為全景圖添加指南針

使用​compass​ 參數和 ​northOffset​ 參數為全景圖添加指南針

  • 我們需要為用參數northOffset指定以 ​度​ 為機關的 ​北偏移量​

效果:

​​Compass​​

<!DOCTYPE HTML>
<html lang="ch">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="author"content=“KaiSarH,[email protected]”>
    <title>Compass</title>
    <link rel="stylesheet" href="pannellum.css"/>
    <script type="text/javascript" src="pannellum.js"></script>
    <style>
        #panorama {
            width: 1200px;
            height: 800px;
        }
    </style>
</head>
<body>
<div id="panorama"></div>
<script>
    pannellum.viewer('panorama', {
        "type": "equirectangular",
        "panorama": "test/test7.jpg",
        // 添加指南針
        "compass": true,
        // 指定北偏移量
        "northOffset": 300
    });
</script>
</body>
</html>      
  1. 首先我們要為compass參數指派為true,為全景圖添加指南針
  2. 然後我們需要為northOffset指派,設定北偏移量