成人性生交大片免费看视频r_亚洲综合极品香蕉久久网_在线视频免费观看一区_亚洲精品亚洲人成人网在线播放_国产精品毛片av_久久久久国产精品www_亚洲国产一区二区三区在线播_日韩一区二区三区四区区区_亚洲精品国产无套在线观_国产免费www

主頁(yè) > 知識(shí)庫(kù) > HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼

HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼

熱門標(biāo)簽:南昌仁和怎么申請(qǐng)開通400電話 如何獲取地圖標(biāo)注客戶 只辦理400電話 平?jīng)龅貓D標(biāo)注位置怎么弄 電話機(jī)器人電銷系統(tǒng)掙話費(fèi) 高德地圖標(biāo)注地點(diǎn)糾錯(cuò) 拓展地圖標(biāo)注 機(jī)器人外呼系統(tǒng)存在哪些能力 電話機(jī)器人黑斑馬免費(fèi)

一、圖片3D展覽效果

上傳圖片的大小有限制,錄制的GIF圖展示效果不是很好

錄屏的效果見鏈接:https://www.bilibili.com/video/BV1Bi4y1E7wk/

二、代碼實(shí)現(xiàn)

1. HTML代碼

<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="HandheldFriendly" content="true">
    <meta name="description" content="圖片3D展覽屋">
    <meta name="keywords" content="canvas,3D_picture,perspective,texturing,gallery">
    <link href="res/slider-wb.css" rel="stylesheet">
    <title>圖片3D展覽屋</title>
    <style>
        html
        {
            overflow:visible;
            -ms-touch-action: none;
            -ms-content-zooming: none;
        }
        body
        {
            position: absolute;
            margin: 0px;
            padding: 0px;
            background: #fff;
            width: 100%;
            height: 100%;
        }
        #canvas
        {
            position: absolute;
            width: 100%;
            height: 100%;
            background: #fff;
        }
    </style>
    <script type="text/javascript" src="res/ge1doot.js"></script>
    <script type="text/javascript">

        "use strict";

        (function () {
            /* ==== definitions ==== */
            var diapo = [], layers = [], ctx, pointer, scr, camera, light, fps = 0, quality = [1, 2],
            // ---- poly constructor ----
	Poly = function (parent, face) {
	    this.parent = parent;
	    this.ctx = ctx;
	    this.color = face.fill || false;
	    this.points = [];
	    if (!face.img) {
	        // ---- create points ----
	        for (var i = 0; i < 4; i++) {
	            this.points[i] = new ge1doot.transform3D.Point(
					parent.pc.x + (face.x[i] * parent.normalZ) + (face.z[i] * parent.normalX),
					parent.pc.y + face.y[i],
					parent.pc.z + (face.x[i] * parent.normalX) + (-face.z[i] * parent.normalZ)
				);
	        }
	        this.points[3].next = false;
	    }
	},
            // ---- diapo constructor ----
	Diapo = function (path, img, structure) {
	    // ---- create image ----
	    this.img = new ge1doot.transform3D.Image(
			this, path + img.img, 1, {
			    isLoaded: function (img) {
			        img.parent.isLoaded = true;
			        img.parent.loaded(img);
			    }
			}
		);
	    this.visible = false;
	    this.normalX = img.nx;
	    this.normalZ = img.nz;
	    // ---- point center ----
	    this.pc = new ge1doot.transform3D.Point(img.x, img.y, img.z);
	    // ---- target positions ----
	    this.tx = img.x + (img.nx * Math.sqrt(camera.focalLength) * 20);
	    this.tz = img.z - (img.nz * Math.sqrt(camera.focalLength) * 20);
	    // ---- create polygons ----
	    this.poly = [];
	    for (var i = -1, p; p = structure[++i]; ) {
	        layers[i] = (p.img === true ? 1 : 2);
	        this.poly.push(
				new Poly(this, p)
			);
	    }
	},
            // ---- init section ----
	init = function (json) {
	    // draw poly primitive
	    Poly.prototype.drawPoly = ge1doot.transform3D.drawPoly;
	    // ---- init screen ----
	    scr = new ge1doot.Screen({
	        container: "canvas"
	    });
	    ctx = scr.ctx;
	    scr.resize();
	    // ---- init pointer ----
	    pointer = new ge1doot.Pointer({
	        tap: function () {
	            if (camera.over) {
	                if (camera.over === camera.target.elem) {
	                    // ---- return to the center ----
	                    camera.target.x = 0;
	                    camera.target.z = 0;
	                    camera.target.elem = false;
	                } else {
	                    // ---- goto diapo ----
	                    camera.target.elem = camera.over;
	                    camera.target.x = camera.over.tx;
	                    camera.target.z = camera.over.tz;
	                    // ---- adapt tesselation level to distance ----
	                    for (var i = 0, d; d = diapo[i++]; ) {
	                        var dx = camera.target.x - d.pc.x;
	                        var dz = camera.target.z - d.pc.z;
	                        var dist = Math.sqrt(dx * dx + dz * dz);
	                        var lev = (dist > 1500) ? quality[0] : quality[1];
	                        d.img.setLevel(lev);
	                    }
	                }
	            }
	        }
	    });
	    // ---- init camera ----
	    camera = new ge1doot.transform3D.Camera({
	        focalLength: Math.sqrt(scr.width) * 10,
	        easeTranslation: 0.025,
	        easeRotation: 0.06,
	        disableRz: true
	    }, {
	        move: function () {
	            this.over = false;
	            // ---- rotation ----
	            if (pointer.isDraging) {
	                this.target.elem = false;
	                this.target.ry = -pointer.Xi * 0.01;
	                this.target.rx = (pointer.Y - scr.height * 0.5) / (scr.height * 0.5);
	            } else {
	                if (this.target.elem) {
	                    this.target.ry = Math.atan2(
							this.target.elem.pc.x - this.x,
							this.target.elem.pc.z - this.z
						);
	                }
	            }
	            this.target.rx *= 0.9;
	        }
	    });
	    camera.z = -10000;
	    camera.py = 0;
	    // ---- create images ----
	    for (var i = 0, img; img = json.imgdata[i++]; ) {
	        diapo.push(
				new Diapo(
					json.options.imagesPath,
					img,
					json.structure
				)
			);
	    }
	    // ---- start engine ---- >>>
	    setInterval(function () {
	        quality = (fps > 50) ? [2, 3] : [1, 2];
	        fps = 0;
	    }, 1000);
	    run();
	},
            // ---- main loop ----
	run = function () {
	    // ---- clear screen ----
	    ctx.clearRect(0, 0, scr.width, scr.height);
	    // ---- camera ----
	    camera.move();
	    // ---- draw layers ----
	    for (var k = -1, l; l = layers[++k]; ) {
	        light = false;
	        for (var i = 0, d; d = diapo[i++]; ) {
	            (l === 1 && d.draw()) ||
				(d.visible && d.poly[k].draw());
	        }
	    }
	    // ---- cursor ----
	    if (camera.over && !pointer.isDraging) {
	        scr.setCursor("pointer");
	    } else {
	        scr.setCursor("move");
	    }
	    // ---- loop ----
	    fps++;
	    requestAnimFrame(run);
	};
            /* ==== prototypes ==== */
            Poly.prototype.draw = function () {
                // ---- color light ----
                var c = this.color;
                if (c.light || !light) {
                    var s = c.light ? this.parent.light : 1;
                    // ---- rgba color ----
                    light = "rgba(" +
				Math.round(c.r * s) + "," +
				Math.round(c.g * s) + "," +
				Math.round(c.b * s) + "," + (c.a || 1) + ")";
                    ctx.fillStyle = light;
                }
                // ---- paint poly ----
                if (!c.light || this.parent.light < 1) {
                    // ---- projection ----
                    for (
				var i = 0;
				this.points[i++].projection();
			);
                    this.drawPoly();
                    ctx.fill();
                }
            }
            /* ==== image onload ==== */
            Diapo.prototype.loaded = function (img) {
                // ---- create points ----
                var d = [-1, 1, 1, -1, 1, 1, -1, -1];
                var w = img.texture.width * 0.5;
                var h = img.texture.height * 0.5;
                for (var i = 0; i < 4; i++) {
                    img.points[i] = new ge1doot.transform3D.Point(
				this.pc.x + (w * this.normalZ * d[i]),
				this.pc.y + (h * d[i + 4]),
				this.pc.z + (w * this.normalX * d[i])
			);
                }
            }
            /* ==== images draw ==== */
            Diapo.prototype.draw = function () {
                // ---- visibility ----
                this.pc.projection();
                if (this.pc.Z > -(camera.focalLength >> 1) && this.img.transform3D(true)) {
                    // ---- light ----
                    this.light = 0.5 + Math.abs(this.normalZ * camera.cosY - this.normalX * camera.sinY) * 0.6;
                    // ---- draw image ----
                    this.visible = true;
                    this.img.draw();
                    // ---- test pointer inside ----
                    if (pointer.hasMoved || pointer.isDown) {
                        if (
					this.img.isPointerInside(
						pointer.X,
						pointer.Y
					)
				) camera.over = this;
                    }
                } else this.visible = false;
                return true;
            }
            return {
                // --- load data ----
                load: function (data) {
                    window.addEventListener('load', function () {
                        ge1doot.loadJS(
					"res/imageTransform3D.js",
					init, data
				);
                    }, false);
                }
            }
        })().load({
            imgdata: [
            // north
		{img: 'imgs/001.jpg', x: -1000, y: 0, z: 1500, nx: 0, nz: 1 },
		{ img: 'imgs/002.jpg', x: 0, y: 0, z: 1500, nx: 0, nz: 1 },
		{ img: 'imgs/003.jpg', x: 1000, y: 0, z: 1500, nx: 0, nz: 1 },
            // east
		{img: 'imgs/004.jpg', x: 1500, y: 0, z: 1000, nx: -1, nz: 0 },
		{ img: 'imgs/005.jpg', x: 1500, y: 0, z: 0, nx: -1, nz: 0 },
		{ img: 'imgs/006.jpg', x: 1500, y: 0, z: -1000, nx: -1, nz: 0 },
            // south
		{img: 'imgs/007.jpg', x: 1000, y: 0, z: -1500, nx: 0, nz: -1 },
		{ img: 'imgs/008.jpg', x: 0, y: 0, z: -1500, nx: 0, nz: -1 },
		{ img: 'imgs/009.jpg', x: -1000, y: 0, z: -1500, nx: 0, nz: -1 },
            // west
		{img: 'imgs/010.jpg', x: -1500, y: 0, z: -1000, nx: 1, nz: 0 },
		{ img: 'imgs/011.jpg', x: -1500, y: 0, z: 0, nx: 1, nz: 0 },
		{ img: 'imgs/012.jpg', x: -1500, y: 0, z: 1000, nx: 1, nz: 0 }
	],
            structure: [
		{
		    // wall
		    fill: { r: 255, g: 255, b: 255, light: 1 },
		    x: [-1001, -490, -490, -1001],
		    z: [-500, -500, -500, -500],
		    y: [500, 500, -500, -500]
		}, {
		    // wall
		    fill: { r: 255, g: 255, b: 255, light: 1 },
		    x: [-501, 2, 2, -500],
		    z: [-500, -500, -500, -500],
		    y: [500, 500, -500, -500]
		}, {
		    // wall
		    fill: { r: 255, g: 255, b: 255, light: 1 },
		    x: [0, 502, 502, 0],
		    z: [-500, -500, -500, -500],
		    y: [500, 500, -500, -500]
		}, {
		    // wall
		    fill: { r: 255, g: 255, b: 255, light: 1 },
		    x: [490, 1002, 1002, 490],
		    z: [-500, -500, -500, -500],
		    y: [500, 500, -500, -500]
		}, {
		    // shadow
		    fill: { r: 0, g: 0, b: 0, a: 0.2 },
		    x: [-420, 420, 420, -420],
		    z: [-500, -500, -500, -500],
		    y: [150, 150, -320, -320]
		}, {
		    // shadow
		    fill: { r: 0, g: 0, b: 0, a: 0.2 },
		    x: [-20, 20, 20, -20],
		    z: [-500, -500, -500, -500],
		    y: [250, 250, 150, 150]
		}, {
		    // shadow
		    fill: { r: 0, g: 0, b: 0, a: 0.2 },
		    x: [-20, 20, 20, -20],
		    z: [-500, -500, -500, -500],
		    y: [-320, -320, -500, -500]
		}, {
		    // shadow
		    fill: { r: 0, g: 0, b: 0, a: 0.2 },
		    x: [-20, 20, 10, -10],
		    z: [-500, -500, -100, -100],
		    y: [-500, -500, -500, -500]
		}, {
		    // base
		    fill: { r: 32, g: 32, b: 32 },
		    x: [-50, 50, 50, -50],
		    z: [-150, -150, -50, -50],
		    y: [-500, -500, -500, -500]
		}, {
		    // support
		    fill: { r: 16, g: 16, b: 16 },
		    x: [-10, 10, 10, -10],
		    z: [-100, -100, -100, -100],
		    y: [300, 300, -500, -500]
		}, {
		    // frame
		    fill: { r: 255, g: 255, b: 255 },
		    x: [-320, -320, -320, -320],
		    z: [0, -20, -20, 0],
		    y: [-190, -190, 190, 190]
		}, {
		    // frame
		    fill: { r: 255, g: 255, b: 255 },
		    x: [320, 320, 320, 320],
		    z: [0, -20, -20, 0],
		    y: [-190, -190, 190, 190]
		},
		{ img: true },
		{
		    // ceilingLight
		    fill: { r: 255, g: 128, b: 0 },
		    x: [-50, 50, 50, -50],
		    z: [450, 450, 550, 550],
		    y: [500, 500, 500, 500]
		}, {
		    // groundLight
		    fill: { r: 255, g: 128, b: 0 },
		    x: [-50, 50, 50, -50],
		    z: [450, 450, 550, 550],
		    y: [-500, -500, -500, -500]
		}
	],
            options: {
                imagesPath: ""
            }
        });
</script>
</head>
<body>
<a href="https://blog.csdn.net/fyfugoyfa/article/details/108845194" target="_blank">CSDN文章</a><br />
    <canvas id="canvas">建議用谷歌瀏覽器打開</canvas>
</body>
</html>

2. CSS代碼

#icon {
	background: rgb(255, 144, 0); border-radius: 6px 0px 0px; transition:0.6s ease-in-out; left: 65px; top: 6px; width: 40px; height: 40px; overflow: hidden; position: relative; cursor: pointer; -moz-transition: all 0.6s ease-in-out 0s; -webkit-transition: all 0.6s ease-in-out 0s; -o-transition: all 0.6s ease-in-out 0s;
}
#icon div {
	background: none; position: absolute;
}
#icon div:nth-child(1) {
	border-width: 7px 0px 7px 8px; border-style: solid; border-color: transparent rgb(255, 255, 255); left: 20px; top: 50%; width: 0px; height: 0px; margin-top: -7px; position: absolute;
}
#icon div:nth-child(2) {
	background: rgb(255, 255, 255); left: 12px; top: 50%; width: 8px; height: 6px; margin-top: -3px; position: absolute;
}
#nav {
	top: 10px; width: 100px; height: 0px; position: absolute; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none;
}
#nav-switch {
	display: none;
}
#nav .label {
	display: block; cursor: pointer;
}
#nav .container {
	transition:left 0.3s ease-in-out; left: -100px; width: 100%; position: absolute; -moz-transition: left 0.3s ease-in-out 0s; -webkit-transition: left 0.3s ease-in-out 0s; -o-transition: left 0.3s ease-in-out 0s;
}
#nav .container > div {
	padding: 0px; width: 50%; float: left;
}
#nav .container .nav-on {
	color: rgb(51, 51, 51); padding-left: 0px;
}
#nav .container .nav-off {
	width: 40px; height: 40px; padding-right: 10px;
}
:checked#nav-switch + .label .container {
	left: 10px;
}
:checked#nav-switch + .label #icon {
	background: rgb(0, 101, 203); border-radius: 0px 0px 6px; transform: rotate(-180deg); -webkit-transform: rotate(-180deg); -moz-transform: rotate(-180deg); -o-transform: rotate(-180deg);
}
.title {
	margin: 0px; padding: 0px; left: 170px; top: 2px; height: 40px; color: rgb(51, 51, 51); line-height: 40px; font-family: "Segoe UI Light", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; font-size: 24px; font-weight: bold; white-space: nowrap; position: absolute; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none;
}
.menu {
	margin: 0px; padding: 0px; left: 0px; top: 6px; color: rgb(51, 51, 51); font-family: "Segoe UI Light", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; font-size: 1em; font-weight: lighter; list-style-type: none; position: relative; cursor: pointer;
}
.menu li {
	list-style: none; width: 100px; height: 40px; border-right-color: rgb(221, 221, 221); border-right-width: 1px; border-right-style: solid; position: relative; cursor: pointer;
}
.menu a {
	color: rgb(51, 51, 51); line-height: 40px; padding-left: 40px; text-decoration: none; display: block; position: relative;
}
.menu li a:hover {
	background: rgb(255, 144, 0);
}
.menu li a:focus {
	background: rgb(255, 144, 0);
}
.menu li a:active {
	background: rgb(255, 144, 0);
}
#nav li::before {
	top: 50%; margin-left: 10px; position: absolute; content: "";
}
#nav li::after {
	top: 50%; margin-left: 10px; position: absolute; content: "";
}
#nav li a::before {
	top: 50%; margin-left: 10px; position: absolute; content: "";
}
#nav li a::after {
	top: 50%; margin-left: 10px; position: absolute; content: "";
}
#nav .home a::before {
	border-width: 8px 7px; border-style: solid; border-color: transparent transparent rgb(51, 51, 51); left: 2px; margin-top: -16px;
}
#nav .home a::after {
	border-width: 3px 4px 0px; border-style: solid; border-color: rgb(51, 51, 51) rgb(51, 51, 51) transparent; left: 4px; width: 2px; height: 4px; margin-top: 0px;
}
#nav .arrow a::before {
	border-width: 7px 0px 7px 8px; border-style: solid; border-color: transparent rgb(51, 51, 51); left: 8px; margin-top: -7px;
}
#nav .arrow a::after {
	background: rgb(51, 51, 51); left: 0px; width: 8px; height: 6px; margin-top: -3px;
}
#nav .back.arrow a::before {
	border-width: 7px 8px 7px 0px; left: 0px;
}
#nav .back.arrow a::after {
	left: 8px;
}
#nav .list a::before {
	background: none; border-width: 6px 0px; border-style: double; border-color: rgb(51, 51, 51); left: 5px; top: 14px; width: 12px; height: 2px;
}
#nav .list a::after {
	background: none; border-width: 6px 0px; border-style: double; border-color: rgb(51, 51, 51); left: 1px; top: 14px; width: 2px; height: 2px;
}

3. JavaScript代碼

// ===== ge1doot global =====    js文件1
var ge1doot = ge1doot || {
	json: null,
	screen: null,
	pointer: null,
	camera: null,
	loadJS: function (url, callback, data) {
		if (typeof url == "string") url = [url];
		var load = function (src) {
			var script = document.createElement("script");
				if (callback) {
					if (script.readyState){
						script.onreadystatechange = function () {
							if (script.readyState == "loaded" || script.readyState == "complete"){
								script.onreadystatechange = null;
								if (--n === 0) callback(data || false);
							}
						}
					} else {
						script.onload = function() {
							if (--n === 0) callback(data || false);
						}
					}
				}
				script.src = src;
				document.getElementsByTagName("head")[0].appendChild(script);
		}
		for (var i = 0, n = url.length; i < n; i++) load(url[i]);
	}
}

// ===== html/canvas container =====
ge1doot.Screen = function (setup) {
	ge1doot.screen = this;
	this.elem = document.getElementById(setup.container) || setup.container;
	this.ctx = this.elem.tagName == "CANVAS" ? this.elem.getContext("2d") : false;
	this.style = this.elem.style;
	this.left = 0;
	this.top = 0;
	this.width = 0;
	this.height = 0;
	this.cursor = "default";
	this.setup = setup;
	this.resize = function () {
		var o = this.elem;
		this.width  = o.offsetWidth;
		this.height = o.offsetHeight;
		for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) {
			this.left += o.offsetLeft;
			this.top  += o.offsetTop;
		}
		if (this.ctx) {
			this.elem.width  = this.width;
			this.elem.height = this.height;
		}
		this.setup.resize && this.setup.resize();
	}
	this.setCursor = function (type) {
		if (type !== this.cursor && 'ontouchstart' in window === false) {
			this.cursor = type;
			this.style.cursor = type;
		}
	}
	window.addEventListener('resize', function () {
		ge1doot.screen.resize();
	}, false);
	!this.setup.resize && this.resize();
}

// ==== unified touch events handler ====
ge1doot.Pointer = function (setup) {
	ge1doot.pointer = this;
	var self        = this;
	var body        = document.body;
	var html        = document.documentElement;
	this.setup      = setup;
	this.screen     = ge1doot.screen;
	this.elem       = this.screen.elem;
	this.X          = 0;
	this.Y          = 0;
	this.Xi         = 0;
	this.Yi         = 0;
	this.bXi        = 0;
	this.bYi        = 0;
	this.Xr         = 0;
	this.Yr         = 0;
	this.startX     = 0;
	this.startY     = 0;
	this.scale      = 0;
	this.wheelDelta = 0;
	this.isDraging  = false;
	this.hasMoved   = false;
	this.isDown     = false;
	this.evt        = false;
	var sX          = 0;
	var sY          = 0;
	// prevent default behavior
	if (setup.tap) this.elem.onclick = function () { return false; }
	if (!setup.documentMove) {
		document.ontouchmove = function(e) { e.preventDefault(); }
	}
	document.addEventListener("MSHoldVisual", function(e) { e.preventDefault(); }, false);
	if (typeof this.elem.style.msTouchAction != 'undefined') this.elem.style.msTouchAction = "none";

	this.pointerDown = function (e) {
		if (!this.isDown) {
			if (this.elem.setCapture) this.elem.setCapture();
			this.isDraging = false;
			this.hasMoved = false;
			this.isDown = true;
			this.evt = e;
			this.Xr = (e.clientX !== undefined ? e.clientX : e.touches[0].clientX);
			this.Yr = (e.clientY !== undefined ? e.clientY : e.touches[0].clientY);
			this.X  = sX = this.Xr - this.screen.left;
			this.Y  = sY = this.Yr - this.screen.top + ((html && html.scrollTop) || body.scrollTop);
			this.setup.down && this.setup.down(e);
		}
	}
	this.pointerMove = function(e) {
		this.Xr = (e.clientX !== undefined ? e.clientX : e.touches[0].clientX);
		this.Yr = (e.clientY !== undefined ? e.clientY : e.touches[0].clientY);
		this.X  = this.Xr - this.screen.left;
		this.Y  = this.Yr - this.screen.top + ((html && html.scrollTop) || body.scrollTop);
		if (this.isDown) {
			this.Xi = this.bXi + (this.X - sX);
			this.Yi = this.bYi - (this.Y - sY);
		}
		if (Math.abs(this.X - sX) > 11 || Math.abs(this.Y - sY) > 11) {
			this.hasMoved = true;
			if (this.isDown) {
				if (!this.isDraging) {
					this.startX = sX;
					this.startY = sY;
					this.setup.startDrag && this.setup.startDrag(e);
					this.isDraging = true;
				} else {
					this.setup.drag && this.setup.drag(e);
				}
			} else {
				sX = this.X;
				sY = this.Y;
			}
		}
		this.setup.move && this.setup.move(e);
	}
	this.pointerUp = function(e) {
		this.bXi = this.Xi;
		this.bYi = this.Yi;
		if (!this.hasMoved) {
			this.X = sX;
			this.Y = sY;
			this.setup.tap && this.setup.tap(this.evt);
		} else {
			this.setup.up && this.setup.up(this.evt);
		}
		this.isDraging = false;
		this.isDown = false;
		this.hasMoved = false;
		this.setup.up && this.setup.up(this.evt);
		if (this.elem.releaseCapture) this.elem.releaseCapture();
		this.evt = false;
	}
	this.pointerCancel = function(e) {
		if (this.elem.releaseCapture) this.elem.releaseCapture();
		this.isDraging = false;
		this.hasMoved = false;
		this.isDown = false;
		this.bXi = this.Xi;
		this.bYi = this.Yi;
		sX = 0;
		sY = 0;
	}
	if ('ontouchstart' in window) {
		this.elem.ontouchstart      = function (e) { self.pointerDown(e); return false;  }
		this.elem.ontouchmove       = function (e) { self.pointerMove(e); return false;  }
		this.elem.ontouchend        = function (e) { self.pointerUp(e); return false;    }
		this.elem.ontouchcancel     = function (e) { self.pointerCancel(e); return false;}
	}
	document.addEventListener("mousedown", function (e) {
		if (
			e.target === self.elem || 
			(e.target.parentNode && e.target.parentNode === self.elem) || 
			(e.target.parentNode.parentNode && e.target.parentNode.parentNode === self.elem)
		) {
			if (typeof e.stopPropagation != "undefined") {
				e.stopPropagation();
			} else {
				e.cancelBubble = true;
			}
			e.preventDefault();
			self.pointerDown(e); 
		}
	}, false);
	document.addEventListener("mousemove", function (e) { self.pointerMove(e); }, false);
	document.addEventListener("mouseup",   function (e) {
		self.pointerUp(e);
	}, false);
	document.addEventListener('gesturechange', function(e) {
		e.preventDefault();
		if (e.scale > 1) self.scale = 0.1; else if (e.scale < 1) self.scale = -0.1; else self.scale = 0;
		self.setup.scale && self.setup.scale(e);
		return false;
	}, false);
	if (window.navigator.msPointerEnabled) {
		var nContact = 0;
		var myGesture = new MSGesture();
		myGesture.target = this.elem;
		this.elem.addEventListener("MSPointerDown", function(e) {
			if (e.pointerType == e.MSPOINTER_TYPE_TOUCH) {
				myGesture.addPointer(e.pointerId);
				nContact++;
			}
		}, false);
		this.elem.addEventListener("MSPointerOut", function(e) {
			if (e.pointerType == e.MSPOINTER_TYPE_TOUCH) {
				nContact--;
			}
		}, false);
		this.elem.addEventListener("MSGestureHold", function(e) {
			e.preventDefault();
		}, false);
		this.elem.addEventListener("MSGestureChange", function(e) {
			if (nContact > 1) {
				if (e.preventDefault) e.preventDefault(); 
				self.scale = e.velocityExpansion;
				self.setup.scale && self.setup.scale(e);
			}
			return false;
		}, false);
	}
	if (window.addEventListener) this.elem.addEventListener('DOMMouseScroll', function(e) { 
		if (e.preventDefault) e.preventDefault(); 
		self.wheelDelta = e.detail * 10;
		self.setup.wheel && self.setup.wheel(e);
		return false; 
	}, false); 
	this.elem.onmousewheel = function () { 
		self.wheelDelta = -event.wheelDelta * .25;
		self.setup.wheel && self.setup.wheel(event);
		return false; 
	}
}

// ===== request animation frame =====
window.requestAnimFrame = (function(){
		return  window.requestAnimationFrame || 
		window.webkitRequestAnimationFrame   || 
		window.mozRequestAnimationFrame      || 
		window.oRequestAnimationFrame        || 
		window.msRequestAnimationFrame       || 
		function( run ){
			window.setTimeout(run, 16);
		};
})();

// ===== ge1doot global =====    js文件1
var ge1doot = ge1doot || {
	json: null,
	screen: null,
	pointer: null,
	camera: null,
	loadJS: function (url, callback, data) {
		if (typeof url == "string") url = [url];
		var load = function (src) {
			var script = document.createElement("script");
				if (callback) {
					if (script.readyState){
						script.onreadystatechange = function () {
							if (script.readyState == "loaded" || script.readyState == "complete"){
								script.onreadystatechange = null;
								if (--n === 0) callback(data || false);
							}
						}
					} else {
						script.onload = function() {
							if (--n === 0) callback(data || false);
						}
					}
				}
				script.src = src;
				document.getElementsByTagName("head")[0].appendChild(script);
		}
		for (var i = 0, n = url.length; i < n; i++) load(url[i]);
	}
}

// ===== html/canvas container =====
ge1doot.Screen = function (setup) {
	ge1doot.screen = this;
	this.elem = document.getElementById(setup.container) || setup.container;
	this.ctx = this.elem.tagName == "CANVAS" ? this.elem.getContext("2d") : false;
	this.style = this.elem.style;
	this.left = 0;
	this.top = 0;
	this.width = 0;
	this.height = 0;
	this.cursor = "default";
	this.setup = setup;
	this.resize = function () {
		var o = this.elem;
		this.width  = o.offsetWidth;
		this.height = o.offsetHeight;
		for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) {
			this.left += o.offsetLeft;
			this.top  += o.offsetTop;
		}
		if (this.ctx) {
			this.elem.width  = this.width;
			this.elem.height = this.height;
		}
		this.setup.resize && this.setup.resize();
	}
	this.setCursor = function (type) {
		if (type !== this.cursor && 'ontouchstart' in window === false) {
			this.cursor = type;
			this.style.cursor = type;
		}
	}
	window.addEventListener('resize', function () {
		ge1doot.screen.resize();
	}, false);
	!this.setup.resize && this.resize();
}

// ==== unified touch events handler ====
ge1doot.Pointer = function (setup) {
	ge1doot.pointer = this;
	var self        = this;
	var body        = document.body;
	var html        = document.documentElement;
	this.setup      = setup;
	this.screen     = ge1doot.screen;
	this.elem       = this.screen.elem;
	this.X          = 0;
	this.Y          = 0;
	this.Xi         = 0;
	this.Yi         = 0;
	this.bXi        = 0;
	this.bYi        = 0;
	this.Xr         = 0;
	this.Yr         = 0;
	this.startX     = 0;
	this.startY     = 0;
	this.scale      = 0;
	this.wheelDelta = 0;
	this.isDraging  = false;
	this.hasMoved   = false;
	this.isDown     = false;
	this.evt        = false;
	var sX          = 0;
	var sY          = 0;
	// prevent default behavior
	if (setup.tap) this.elem.onclick = function () { return false; }
	if (!setup.documentMove) {
		document.ontouchmove = function(e) { e.preventDefault(); }
	}
	document.addEventListener("MSHoldVisual", function(e) { e.preventDefault(); }, false);
	if (typeof this.elem.style.msTouchAction != 'undefined') this.elem.style.msTouchAction = "none";

	this.pointerDown = function (e) {
		if (!this.isDown) {
			if (this.elem.setCapture) this.elem.setCapture();
			this.isDraging = false;
			this.hasMoved = false;
			this.isDown = true;
			this.evt = e;
			this.Xr = (e.clientX !== undefined ? e.clientX : e.touches[0].clientX);
			this.Yr = (e.clientY !== undefined ? e.clientY : e.touches[0].clientY);
			this.X  = sX = this.Xr - this.screen.left;
			this.Y  = sY = this.Yr - this.screen.top + ((html && html.scrollTop) || body.scrollTop);
			this.setup.down && this.setup.down(e);
		}
	}
	this.pointerMove = function(e) {
		this.Xr = (e.clientX !== undefined ? e.clientX : e.touches[0].clientX);
		this.Yr = (e.clientY !== undefined ? e.clientY : e.touches[0].clientY);
		this.X  = this.Xr - this.screen.left;
		this.Y  = this.Yr - this.screen.top + ((html && html.scrollTop) || body.scrollTop);
		if (this.isDown) {
			this.Xi = this.bXi + (this.X - sX);
			this.Yi = this.bYi - (this.Y - sY);
		}
		if (Math.abs(this.X - sX) > 11 || Math.abs(this.Y - sY) > 11) {
			this.hasMoved = true;
			if (this.isDown) {
				if (!this.isDraging) {
					this.startX = sX;
					this.startY = sY;
					this.setup.startDrag && this.setup.startDrag(e);
					this.isDraging = true;
				} else {
					this.setup.drag && this.setup.drag(e);
				}
			} else {
				sX = this.X;
				sY = this.Y;
			}
		}
		this.setup.move && this.setup.move(e);
	}
	this.pointerUp = function(e) {
		this.bXi = this.Xi;
		this.bYi = this.Yi;
		if (!this.hasMoved) {
			this.X = sX;
			this.Y = sY;
			this.setup.tap && this.setup.tap(this.evt);
		} else {
			this.setup.up && this.setup.up(this.evt);
		}
		this.isDraging = false;
		this.isDown = false;
		this.hasMoved = false;
		this.setup.up && this.setup.up(this.evt);
		if (this.elem.releaseCapture) this.elem.releaseCapture();
		this.evt = false;
	}
	this.pointerCancel = function(e) {
		if (this.elem.releaseCapture) this.elem.releaseCapture();
		this.isDraging = false;
		this.hasMoved = false;
		this.isDown = false;
		this.bXi = this.Xi;
		this.bYi = this.Yi;
		sX = 0;
		sY = 0;
	}
	if ('ontouchstart' in window) {
		this.elem.ontouchstart      = function (e) { self.pointerDown(e); return false;  }
		this.elem.ontouchmove       = function (e) { self.pointerMove(e); return false;  }
		this.elem.ontouchend        = function (e) { self.pointerUp(e); return false;    }
		this.elem.ontouchcancel     = function (e) { self.pointerCancel(e); return false;}
	}
	document.addEventListener("mousedown", function (e) {
		if (
			e.target === self.elem || 
			(e.target.parentNode && e.target.parentNode === self.elem) || 
			(e.target.parentNode.parentNode && e.target.parentNode.parentNode === self.elem)
		) {
			if (typeof e.stopPropagation != "undefined") {
				e.stopPropagation();
			} else {
				e.cancelBubble = true;
			}
			e.preventDefault();
			self.pointerDown(e); 
		}
	}, false);
	document.addEventListener("mousemove", function (e) { self.pointerMove(e); }, false);
	document.addEventListener("mouseup",   function (e) {
		self.pointerUp(e);
	}, false);
	document.addEventListener('gesturechange', function(e) {
		e.preventDefault();
		if (e.scale > 1) self.scale = 0.1; else if (e.scale < 1) self.scale = -0.1; else self.scale = 0;
		self.setup.scale && self.setup.scale(e);
		return false;
	}, false);
	if (window.navigator.msPointerEnabled) {
		var nContact = 0;
		var myGesture = new MSGesture();
		myGesture.target = this.elem;
		this.elem.addEventListener("MSPointerDown", function(e) {
			if (e.pointerType == e.MSPOINTER_TYPE_TOUCH) {
				myGesture.addPointer(e.pointerId);
				nContact++;
			}
		}, false);
		this.elem.addEventListener("MSPointerOut", function(e) {
			if (e.pointerType == e.MSPOINTER_TYPE_TOUCH) {
				nContact--;
			}
		}, false);
		this.elem.addEventListener("MSGestureHold", function(e) {
			e.preventDefault();
		}, false);
		this.elem.addEventListener("MSGestureChange", function(e) {
			if (nContact > 1) {
				if (e.preventDefault) e.preventDefault(); 
				self.scale = e.velocityExpansion;
				self.setup.scale && self.setup.scale(e);
			}
			return false;
		}, false);
	}
	if (window.addEventListener) this.elem.addEventListener('DOMMouseScroll', function(e) { 
		if (e.preventDefault) e.preventDefault(); 
		self.wheelDelta = e.detail * 10;
		self.setup.wheel && self.setup.wheel(e);
		return false; 
	}, false); 
	this.elem.onmousewheel = function () { 
		self.wheelDelta = -event.wheelDelta * .25;
		self.setup.wheel && self.setup.wheel(event);
		return false; 
	}
}

// ===== request animation frame =====
window.requestAnimFrame = (function(){
		return  window.requestAnimationFrame || 
		window.webkitRequestAnimationFrame   || 
		window.mozRequestAnimationFrame      || 
		window.oRequestAnimationFrame        || 
		window.msRequestAnimationFrame       || 
		function( run ){
			window.setTimeout(run, 16);
		};
})();

到此這篇關(guān)于HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼的文章就介紹到這了,更多相關(guān)HTML圖片3D展覽內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

標(biāo)簽:永州 池州 棗莊 漯河 新疆 青島 西藏 遼源

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼》,本文關(guān)鍵詞  HTML+CSS+JavaScript,實(shí)現(xiàn),圖片,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于HTML+CSS+JavaScript實(shí)現(xiàn)圖片3D展覽的示例代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    1024成人网| 日韩专区一区二区| 亚洲最大中文字幕| 综合久久久久综合| 影音先锋在线中文字幕| 深夜福利成人| 国产a级片免费观看| www.久久国产| 国产在线观看不卡一区二区三区| 自拍网站在线观看| 中文字幕在线不卡一区二区三区| 中文字幕欧美激情极品| 日本欧美不卡| 麻豆精品一区二区三区视频| 高清wwwwxxxx| 自拍偷拍亚洲欧美| xxxx黄色| 欧美高清videosex极品| 公侵犯人妻一区二区三区| 亚洲图片欧洲图片日韩av| 日本亚洲欧洲色| 亚洲欧美日韩中文在线制服| 日本免费一二三区| 国产成人亚洲精品乱码在线观看| 成人av在线一区二区三区| 国产精品白嫩美女在线观看| 欧美激情视频免费看| 五月激情久久久| 91好吊色国产欧美日韩在线| 国模私拍一区二区| 综合久久给合久久狠狠狠97色| 欧美性视频网站| 欧美激情网友自拍| 成人国产电影网| 欧美人与性动交α欧美精品济南到| 无码人妻丰满熟妇区五十路| 日本一区免费看| 日韩精品免费在线| 国产午夜精品一区| 尤物影院在线播放| 一区二区久久| 嫩草视频在线免费观看| 亚洲视频国产视频| 日本高清网站| 蜜桃久久精品成人无码av| 日本在线中文电影| 国产成人综合自拍| 欧美日韩激情视频8区| 国产成人精品久久一区二区小说| 天天操 夜夜操| 婷婷色中文字幕| 69**夜色精品国产69乱| 污网站在线免费看| 国产黄色美女视频| 免费成人在线观看视频| 日韩欧美综合在线| 四虎成人永久免费视频| 亚洲美女视频在线观看| 久久一本综合频道| 日韩精品一区二区三区在线观看| 亚洲在线不卡| 亚洲专区一二三| 欧美理论电影在线| 亚洲一区中文字幕在线| 中文字幕丰满人伦在线| 亚洲精品视频二区| 一级在线观看视频| 精品一区毛片| 免费看国产一级片| 致1999电视剧免费观看策驰影院| 国产一区二区你懂的| 色综合伊人色综合网| 日韩电影毛片| 日本大胆欧美| 国产精品网红福利| 国产中文字幕一区二区三区| 在线播放/欧美激情| 黄在线免费观看| 欧美写真视频一区| 永久免费在线观看视频| 欧美日韩在线中文字幕| 国产91一区二区三区| 91精品视频免费观看| 国产精品短视频| 99re国产在线播放| 91九色美女在线视频| 日本v片在线高清不卡在线观看| 欧美sm美女调教| 宅男噜噜噜66国产精品免费| 亚洲天堂网在线观看视频| 中文字幕高清不卡| 蜜桃视频在线网站| 香蕉视频国产精品| 久久久亚洲精品视频| 日韩亚洲视频在线| 欧美肥臀大乳一区二区免费视频| 亚洲丝袜精品| 日韩在线观看免费全| 亚洲国产另类久久久精品极度| 亚洲第一精品区| 一级日本黄色片| 欧美一区二区三区精美影视| 最近免费中文字幕大全免费版视频| 在线观看一区日韩| 精品国产一区二区三区在线| 久久成人精品电影| 色噜噜狠狠成人网p站| 欧美视频在线观看免费| 色哟哟在线观看视频| 久久网一区二区| 久久久久无码精品| 国产精品美女www爽爽爽视频| 这里只有精品视频在线| 亚洲精品大片www| 中文字幕精品—区二区日日骚| 不卡av在线网站| 无码少妇一区二区三区芒果| 91精品999| 久久久久久久久久久久久9999| 91精品欧美一区二区三区综合在| 日本不卡一区二区三区视频| 精品国产大片大片大片| 国产aⅴ精品一区二区三区色成熟| 在线观看日韩欧美| 91久久精品美女高潮| 欧美日韩hd| 日韩欧美精品久久| 欧美激情在线观看视频| 亚洲精品成人无码毛片| 蜜月aⅴ免费一区二区三区| 成人天堂yy6080亚洲高清| 日日夜夜一区| 亚洲日本在线a| 欧美一级夜夜爽| 国产99在线|亚洲| 日韩美女激情视频| 国产精品高潮呻吟久久久久| 国产一区二区三区播放| 不卡免费追剧大全电视剧网站| 国产精品高潮呻吟视频| 18深夜在线观看免费视频| 国产精品影视天天线| avtt香蕉久久| 日韩欧美国产成人一区二区| 国内精品伊人久久久久av一坑| 国产午夜精品全部视频在线播放| 日韩—二三区免费观看av| 天天色天天干天天色| 成人欧美视频在线观看播放| 国产精品20p| 91蜜桃视频在线| 国产精品一区=区| 亚洲第一区色| 91蜜桃传媒精品久久久一区二区| 99中文字幕在线观看| av成人免费| 91福利精品第一导航| 99精品国产热久久91蜜凸| 在线观看免费av网址| 欧美色网址大全| 成人欧美一区二区三区在线湿哒哒| 天堂网一区二区三区| 欧美色图自拍| 国产精品美女主播| 性猛交ⅹxxx富婆video| 亚洲av成人无码久久精品老人| 亚洲另类av| 九九热线视频只有这里最精品| 孩xxxx性bbbb欧美| 国产在线精品一区二区不卡| 哥也色在线视频| www视频在线观看| 九九九热999| 台湾佬中文在线| 亚洲va久久久噜噜噜| 精品福利视频导航| 久青草视频在线播放| 国产成人小视频| 五月天婷婷色综合| 宅男噜噜噜66一区二区66| 亚洲免费小视频| 91精品国产99久久久久久| 一本色道**综合亚洲精品蜜桃冫| 999在线免费观看视频| 国产欧美日韩在线一区二区| aaaa黄色片| 黄色污污在线观看| 丁香激情视频| 欧美三级网站在线观看| 久久中文视频| 欧美三级一区二区三区| 菠萝蜜影院一区二区免费| 久久久久久久久久久久av| 精品偷拍一区二区三区在线看| 麻豆一区在线| 5566成人精品视频免费| 野花社区视频在线观看| 福利片在线观看| 国产最新免费视频| 亚洲一卡二卡三卡四卡无卡网站在线看| 精品久久久久久最新网址| 久久久久久久久久久久久久久久久久| 孩娇小videos精品| 亚洲无限乱码一二三四麻| 精品久久久久一区| 日本欧美韩国一区三区| 天堂av中文字幕| 男人午夜影院| 国产亚洲高清视频| 91免费视频播放| 26uuu成人| 日韩久久久精品| 熟女俱乐部一区二区| 亚洲男人天堂2023| 男人亚洲天堂网| 久久久久久久久久99| 九色视频一区| siro系绝美精品系列| 国内少妇毛片视频| 五月天综合在线| 校花撩起jk露出白色内裤国产精品| 欧美极品免费| 国产老女人乱淫免费| 亚洲综合在线电影| 午夜激情影院在线观看| 精品动漫一区二区三区在线观看| 国产亚洲欧美日韩在线一区| 四虎精品成人a在线观看| 国产精品69xx| 久久99久久99精品免费看小说| 欧美性受xxxx黑人猛交| 久久久久久久久艹| 欧美军人男男激情gay| 好看的av在线不卡观看| 久久国产精品精品国产色婷婷| 三级网站在线| 日本一区影院| 久久亚洲电影天堂| 精品国产一区二区三区忘忧草| 国产精品视频在线观看免费| aa国产精品| 国产精品三区在线观看| 成年免费视频黄网站在线观看| 免费不卡视频| 日韩av电影在线免费播放| 亚洲免费黄色| 亚洲v国产v| 色一情一乱一伦一区二区三欧美| 中文字幕视频在线免费| 豆花视频一区| 国产精品免费av一区二区| 99视频精品全部免费在线视频| 国产精品www网站| 成人免费福利| 国产精品日韩高清| 精品视频vs精品视频| 国产a免费视频| 九色91在线视频| 国内精品免费**视频| 粉嫩蜜臀av国产精品网站| 一本久道中文字幕精品亚洲嫩| 日韩伦理三区| 国产日韩欧美精品一区二区三区| 欧美日韩精品中文字幕| 久久无码高潮喷水| 国产在线观看免费播放| 欧美怡红院视频一区二区三区| 疯狂做受xxxx高潮欧美日本| 最新国产の精品合集bt伙计| av成人在线播放| 日韩欧美国产精品| 亚洲天堂成人在线视频| 国产成人精品在线视频| 欧美激情在线一区二区三区| 一区二区三区国产精华| 色噜噜久久综合伊人一本| 国产女人18水真多毛片18精品| 伊人精品视频在线观看| 亚洲一区在线观| 毛片a片免费观看| 久久夜靖品2区| 成人精品天堂一区二区三区| 日韩高清免费观看| 亚洲精品97久久中文字幕无码| 成人福利视频导航| 亚洲天堂aaa| 一区二区三区四区中文字幕| 欧洲成人一区| 爱情岛论坛亚洲首页入口章节| 黄色一级片视频| 在线观看网站免费入口在线观看国内| 91入口在线观看| 国产精品成人一区二区艾草| 国产精品日韩久久久| 亚洲欧美成人| 精品久久久久久久久久久院品网| 亚洲欧美日韩综合网| 91激情五月电影| 国产女女做受ⅹxx高潮| 日韩国产91| 成人综合在线观看| 亚洲一区二区三区蜜桃| 不卡的av电影在线观看| 精品国产91久久久久久浪潮蜜月| 男女性色大片免费观看一区二区| 青青视频免费在线| 亚洲毛片av| 男女猛烈无遮挡午夜视频| 国产一区二区三区四区在线观看| 91久久免费观看| 国产激情视频在线| 亚洲精品一区三区三区在线观看| 岛国视频一区| 国产cdts系列另类在线观看| 7777精品伊人久久久大香线蕉超级流畅| 欧美欧美一区二区| 日韩不卡av| 欧美gv在线观看| www一区二区www免费| 日韩在线视频中文字幕| 激情五月婷婷在线| 日本xxxxxx| 激情久久一区二区| 日韩久久精品网| 色哟哟视频在线| 久久精品国产大片免费观看| 蜜桃视频涩涩| 精品无码人妻一区二区三区品|