


Sharing of implementation examples of panoramic decoration drawings on mobile terminals
Sharing of implementation examples of panoramic decoration drawings on mobile terminals
<!DOCTYPE html> <html lang="en"> <head> <meta name="viewport" content="width=device-width,user-scalable=no" /> <meta charset="UTF-8"> <title>Document</title> <style type="text/css"> body, html { margin: 0; height: 100%; overflow: hidden; position: relative; } .wrap { position: relative; height: 100%; } .view, .boxZ, .box { position: absolute; left: 50%; top: 50%; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .box { -webkit-transform: rotateY(0deg); transform: rotateY(0deg); -webkit-animation: 36s rotate infinite linear; animation: 36s rotate infinite linear; } .box span { position: absolute; left: 50%; top: 50%; margin: -512px 0 0 -512px; width: 1024px; height: 1024px; text-align: center; -webkit-backface-visibility: hidden; backface-visibility: hidden; /* 背面,角度和父级的角度相对的面是背景 */ } .box span:nth-of-type(1) { -webkit-transform: rotateY(0deg) translateZ(-510px); transform: rotateY(0deg) translateZ(-511px); background: url(img/neg-x.png) no-repeat; } .box span:nth-of-type(2) { -webkit-transform: rotateY(90deg) translateZ(-511px); transform: rotateY(90deg) translateZ(-511px); background: url(img/neg-z.png) no-repeat; } .box span:nth-of-type(3) { -webkit-transform: rotateY(180deg) translateZ(-511px); transform: rotateY(180deg) translateZ(-511px); background: url(img/pos-x.png) no-repeat; } .box span:nth-of-type(4) { background: url(img/pos-z.png) no-repeat; -webkit-transform: rotateY(270deg) translateZ(-511px); transform: rotateY(270deg) translateZ(-511px); } .box span:nth-of-type(5) { background: url(img/pos-y.png); -webkit-transform: rotateX(-90deg) translateZ(-511px); transform: rotateX(-90deg) translateZ(-511px); } .box span:nth-of-type(6) { background: url(img/neg-y.png); -webkit-transform: rotateX(90deg) translateZ(-511px); transform: rotateX(90deg) translateZ(-511px); } /* transform-origin z轴的设置,在ios下有兼容问题 */ #loading { position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 10; background: #fff url(img/loading.gif) no-repeat center center; } </style> </head> <body> <div id="loading"></div> <script type="text/javascript"> /* 检测图片加载完成 */ (function(){ var imgData = [ "img/neg-x.png", "img/neg-y.png", "img/neg-z.png", "img/pos-x.png", "img/pos-y.png", "img/pos-z.png" ]; var nub = 0; for(var i = 0; i < imgData.length; i++){ load(imgData[i]); } function load(url){ var img = new Image(); img.onload = function(){ nub++; if(nub == imgData.length){ loading.style.display = "none"; } }; img.src = url; } })(); </script> <div class="wrap"> <div class="view"> <div class="boxZ"> <div class="box"> <span></span> <span></span> <span></span> <span></span> <span></span> <span></span> </div> </div> </div> </div> <script type="text/javascript" src="js/m.touch.js?1.1.11"></script> <script type="text/javascript"> (function(){ setPerspective(); window.addEventListener('resize', function(e) { setPerspective(); }); function setPerspective(){ var wrap = document.querySelector('.wrap'); var view = document.querySelector('.view'); var boxZ = document.querySelector('.boxZ'); var deg = 45;//视野夹角(角度越小,看到的范围越广,角度越大,看到的范围越少); var Z = Math.round(Math.tan(deg*Math.PI/180)*wrap.clientHeight/2);//计算景深 wrap.style.perspective = wrap.style.WebKitPerspective = Z + "px"; //距离景物距离不变,那看到的画面大小就不变 css(view,"translateZ",Z); css(boxZ,"translateZ",-100); } })(); (function(){ var box = document.querySelector('.box'); css(box,"rotateX",0); css(box,"rotateY",0); window.addEventListener('deviceorientation', function(e) { var x = e.beta; var y = e.gamma; var z = e.alpha; var rotateX = x - 90; var rotateY = (y + z)%360; if(rotateX > 60){ rotateX = 60; } else if(rotateX <-60){ rotateX = -60; } css(box,"rotateX",rotateX); css(box,"rotateY",-rotateY); }); })(); // </script> </body> </html>
The above is the detailed content of Sharing of implementation examples of panoramic decoration drawings on mobile terminals. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.
