123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <script src="//4dkk.4dage.com/v4/sdk/4.2.0/kankan-sdk-deps.js"></script>
- <script src="//4dkk.4dage.com/v4/sdk/4.2.0/kankan-sdk.js"></script>
- <style>
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- html,
- body {
- width: 100%;
- height: 100%;
- overflow: hidden;
- }
- .box {
- width: 100%;
- height: 100%;
- }
- [xui_min_map] {
- right: 10px;
- top: 75px
- }
- .inco {
- position: absolute;
- bottom: 20px;
- left: 50px;
- width: 160px;
- height: 36px;
- background-color: rgba(0, 0, 0, .4);
- border-radius: 18px;
- z-index: 11;
- display: flex;
- justify-content: space-around;
- padding: 0 10px 0 15px;
- }
- .inco>div {
- cursor: pointer;
- width: 33%;
- height: 100%;
- display: flex;
- justify-content: center;
- align-items: center;
- background-size: 36px 36px;
- background-repeat: no-repeat;
- background-position: center;
- }
- .inco1 {
- background-image: url('./img/inco1Ac.png');
- width: 22% !important;
- }
- .inco2 {
- background-image: url('./img/inco2.png');
- }
- .inco3 {
- background-image: url('./img/inco3.png');
- }
- .loading {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 12;
- width: 100%;
- height: 100%;
- background-color: black;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .loading .loadBox {
- color: #fff;
- text-align: center;
- letter-spacing: 2px;
- width: 110px;
- height: 110px;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 2px;
- }
- .loadIcon {
- width: 60px;
- height: 60px;
- position: relative;
- overflow: hidden;
- margin: 10px auto;
- }
- .loadIcon img {
- height: 60px;
- position: absolute;
- left: 0;
- top: 0;
- animation: loading 1s steps(15) infinite;
- }
- @keyframes loading {
- 100% {
- left: -900px;
- }
- }
- </style>
- </head>
- <body>
- <div class="loading">
- <div class="loadBox">
- <div class="loadIcon">
- <img src="./img/loading.png" alt="">
- </div>
- <div class="txt">加载中</div>
- </div>
- </div>
- <div class="box"></div>
- <div class="inco">
- <div class="inco1 active" title="全景漫游"></div>
- <div class="inco2" title="俯视图"></div>
- <div class="inco3" title="迷你模型"></div>
- </div>
- </body>
- <script>
- // 获取地址栏信息
- let GetQueryString = (name) => {
- let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
- let r = window.location.search.substr(1).match(reg);
- if (r != null) return unescape(r[2]);
- return "";
- }
- let num = GetQueryString('m')
- var kankan = new KanKan({
- dom: '.box',
- num
- })
- kankan.use('MinMap', {
- theme: {
- camera_fillStyle: "#C48871"
- }
- })
- kankan.render()
- kankan.Scene.on('loaded', () => {
- document.querySelector('.loading').style.display = 'none'
- //设置地面logo
- kankan.Scene.setFloorLogo({
- url: 'img/diBiao.png'
- })
- })
- let doms = document.querySelectorAll('.inco div')
- kankan.Camera.on('mode.afterChange', ({
- fromMode,
- toMode,
- floorIndex
- }) => {
- if (toMode == 'panorama') {
- doms[0].classList.add('active')
- doms[1].classList.remove('active')
- doms[2].classList.remove('active')
- doms[0].style.backgroundImage = "url(./img/inco1Ac.png)"
- doms[1].style.backgroundImage = "url(./img/inco2.png)"
- doms[2].style.backgroundImage = "url(./img/inco3.png)"
- }
- })
- doms.forEach((v, i) => {
- v.onclick = function () {
- let className = v.getAttribute('class')
- if (className.includes('active')) return
- if (i == 0) {
- doms[0].classList.add('active')
- doms[1].classList.remove('active')
- doms[2].classList.remove('active')
- doms[0].style.backgroundImage = "url(./img/inco1Ac.png)"
- doms[1].style.backgroundImage = "url(./img/inco2.png)"
- doms[2].style.backgroundImage = "url(./img/inco3.png)"
- kankan.Camera.panorama()
- } else if (i == 1) {
- doms[0].classList.remove('active')
- doms[1].classList.add('active')
- doms[2].classList.remove('active')
- doms[0].style.backgroundImage = "url(./img/inco1.png)"
- doms[1].style.backgroundImage = "url(./img/inco2Ac.png)"
- doms[2].style.backgroundImage = "url(./img/inco3.png)"
- kankan.Camera.floorplan()
- } else {
- doms[0].classList.remove('active')
- doms[1].classList.remove('active')
- doms[2].classList.add('active')
- doms[0].style.backgroundImage = "url(./img/inco1.png)"
- doms[1].style.backgroundImage = "url(./img/inco2.png)"
- doms[2].style.backgroundImage = "url(./img/inco3Ac.png)"
- kankan.Camera.dollhouse()
- }
- }
- })
- </script>
- </html>
|