page1.html 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/html">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>全景展示</title>
  6. <script src="three.js"></script>
  7. <script src="/origin/tpanorama.js"></script>
  8. <style>
  9. body {
  10. margin: 0;
  11. overflow: hidden;
  12. }
  13. #panoramaConianer {
  14. overflow: hidden;
  15. position: absolute;
  16. height: 100%;
  17. width: 100%;
  18. }
  19. #tool {
  20. position: absolute;
  21. right: 0px;
  22. width: 10%;
  23. height: 100%;
  24. background-color: cadetblue;
  25. color: white;
  26. }
  27. </style>
  28. <script>
  29. var opt, tp;
  30. window.onload = function () {
  31. opt = {
  32. container: 'panoramaConianer',//容器
  33. url: 'img/p3.png',
  34. lables: [
  35. { position: { lon: -72.00, lat: 9.00 }, logoUrl: '', text: '蓝窗户' },
  36. { position: { lon: 114.12, lat: 69.48 }, logoUrl: '', text: '一片云彩' },
  37. { position: { lon: 132.48, lat: -12.24 }, logoUrl: '', text: '大海' }
  38. ],
  39. widthSegments: 60,//水平切段数
  40. heightSegments: 40,//垂直切段数(值小粗糙速度快,值大精细速度慢)
  41. pRadius: 1000,//全景球的半径,推荐使用默认值
  42. minFocalLength: 6,//镜头最小拉近距离
  43. maxFocalLength: 100,//镜头最大拉近距离
  44. }
  45. tp = new tpanorama(opt);
  46. }
  47. function changeImg(name) {
  48. opt.lables = [];
  49. if (name == "p1") {
  50. opt.lables = [{ position: { lon: 178.56, lat: -15.84 }, text: '神像' }]
  51. }
  52. if (name == "p2") {
  53. opt.lables = [{ position: { lon: -80.64, lat: -16.92 }, text: '蓝色' }, { position: { lon: 46.80, lat: 10.44 }, text: '绿色' }]
  54. }
  55. if (name == "p4") {
  56. opt.lables = [{ position: { lon: 48.96, lat: -20.16 }, text: '樱花' }]
  57. }
  58. opt.url = 'img/' + name + '.png';
  59. tp.render(opt);
  60. }
  61. </script>
  62. </head>
  63. <body>
  64. <div id="panoramaConianer"></div>
  65. <!-- <div id="tool">
  66. </br>
  67. </br>
  68. <button onclick="changeImg('p1')">图1</button>
  69. </br>
  70. </br>
  71. <button onclick="changeImg('p2')">图2</button>
  72. </br>
  73. </br>
  74. <button onclick="changeImg('p4')">图4</button>
  75. </br>
  76. </br>
  77. </div> -->
  78. </body>
  79. </html>