播放簡單的圓柱投影
效果:
A simple example
<!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>A simple example</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可以建立一個新的全景對象
// 第一個參數type設定Pannellum處理全景圖檔的方式
// 第二個參數panorama添加全景圖檔
pannellum.viewer('panorama', {
"type": "equirectangular",
"panorama": "test/test.jpg"
});
</script>
</body>
</html>
-
- 當我們在使用Pannellum的時候,需要把pannnellum.css和pannnellum.js引入到項目中
- 定義一個存儲全景圖的div(似曾相識的地方—openLayer)
- 使用pannellum.viewer建立一個全景對象
- 對viewer的參數進行設定
- 參數type設定Pannellum處理全景圖檔的方式
- 參數panorama添加全景圖檔