手抄报 安全手抄报 手抄报内容 手抄报图片 英语手抄报 清明节手抄报 节约用水手抄报

Photo Sphere Viewer使用攻略

时间:2024-10-13 19:18:34

1、使用该全景图插件时要引入three.min.js和photo-sphere-viewer.min.js文件。<script src="js/three.min.js"></script><script src="js/photo-sphere-viewer.min.js"></script>

Photo Sphere Viewer使用攻略

2、可以创建一个空的<div>来放置全景图,通过CSS来设置它的尺寸。<div id="container"></div>

Photo Sphere Viewer使用攻略

3、要初始化该全景图插件,可以创建一个新的PhotoSphereViewer对象,然后在这个对象中插入一个参数对象,有两个参数是必须设置的:var PSV = new PhotoSphereViewer({ // Path to the panorama panorama: '1.jpg', // Container container: div});

Photo Sphere Viewer使用攻略

4、下面是该全景图插件的所有可用配置参数:panorama:必填参数,全景图的路径。container:必填参数,放置全景图的div元素。autoload:可选,默鹚剖蛲蛋认值为true,true为自动调用全景图,false为在后面加载全景图(通过.load()方法)。usexmpdata:可选,默认值为true,如果Photo Sphere Viewer必须读入XMP数据则为true。default_position:可选,默认值为{},定义默认的位置,及用户看见的第一个点,例如:{long: Math.PI, lat: Math.PI/2}。min_fov:可选,默认值为30,观察的最小区域,单位degrees,在1-179之间。max_fov:可选,默认值为90,观察的最大区域,单位degrees,在1-179之间。allow_user_interactions:可选,默认值为true,设置为false则禁止用户和全景图交互(导航条不可用)。tilt_up_max:可选,默认值为Math.PI/2,向上倾斜的最大角度,单位radians。tilt_down_max:可选,默认值为Math.PI/2,向下倾斜的最大角度,单位radians。zoom_level:可选,默认值为0,默认的缩放级别,值在0-100之间。long_offset:可选,默认值为PI/360,mouse/touch移动时每像素经过的经度值。lat_offset:可选,默认值为PI/180,mouse/touch移动时每像素经过的纬度值。time_anim:可选,默认值为2000,全景图在time_anim毫秒后会自动进行动画。(设置为false禁用它)theta_offset:过时的选项,可选,默认值为1440,自动动画时水平方向的速度。anim_speed:可选,默认值为2rpm,动画的速度,每秒/分钟多少radians/degrees/revolutions。navbar:可选值,默认为false。显示导航条。

5、navbar_style:可选撕良滤儆值,默认为{}。导航条的自定义样式。下面是可用的样式列表:backgroundColor:导航条的背景颜色,默认值为rgba(61, 61, 61, 0.5像粜杵泳)。buttonsColor:按钮的前景颜色,默认值为transparent。activeButtonsBackgroundColor:按钮激活状态的背景颜色,默认值为rgba(255, 255, 255, 0.1)。buttonsHeight:按钮的高度,单位像素,默认值为20。autorotateThickness:autorotate图标的厚度,单位像素,默认值为1。zoomRangeWidth:缩放的范围,单位显示,默认值50。zoomRangeThickness:缩放的范围的厚度,单位像素,默认值1。zoomRangeDisk:缩放范围的圆盘直径,单位像素,默认值为7。fullscreenRatio:全屏图标的比例,默认值为3/4。fullscreenThickness:全屏图标的厚度,单位像素,默认值为2。loading_msg:可选,默认值为Loading…,图片加载时的提示文字。loading_img:可选,默认值为null,在加载时显示的图片的路径。size:可选,默认值null,全景图容器的最终尺寸。例如:{width: 500, height: 300}。onready:可选值,默认值为null。当全景图准备就绪并且第一张图片显示时的回调函数。

6、<!doctype html><html><head><m髫潋啜缅eta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>基于Three.js的360X180度全景图预览插件</title><link rel="stylesheet" type="text/css" href="css/normalize.css" /><link rel="stylesheet" type="text/css" href="css/default.css"><link rel="stylesheet" href="css/example1.css" /><script src="js/three.min.js"></script><script src="js/photo-sphere-viewer.min.js"></script><script src="js/example1.js"></script><!--[if IE]><script src="http://libs.useso.com/js/html5shiv/3.7/html5shiv.min.js"></script><![endif]--></head><body><div><header><h1>基于Three.js的360X180度全景图预览插件 <span>A JavaScript library to display Photo Sphere panoramas</span></h1><div><a class="htmleaf-icon icon-htmleaf-home-outline" href="http://www.htmleaf.com/" title="jQuery之家" target="_blank"><span> jQuery之家</span></a><a class="htmleaf-icon icon-htmleaf-arrow-forward-outline" href="http://www.htmleaf.com/jQuery/Image-Effects/201508112394.html" title="返回下载页" target="_blank"><span> 返回下载页</span></a></div></header><div id="content"><p>下面的例子可以让你调用预定义的全景图来测试这个全景图插件。点击下面的按钮来查看效果。</p><p>To see this panorama, just hit the link below: currently, the <code>div</code> has a height of 0 pixel but Photo Sphere Viewer will increase it to 500 pixels.</p><div id="container"></div><p style="text-align: center;"><a href="#" id="go">调用预定义的全景图</a></p><p>Note that the panorama is here given as a relative path, but you can give to Photo Sphere Viewer an absolute one or an URL pointing to another website if this website allows CORS.</p><p>通过下面的按钮你可以上传自己电脑上的全景图来查看效果。代码使用FileReader API,非常简单,可以查看<code>example1.js</code>文件。 </p><div id="your-pano"></div><form method="get" action="example1.html"><p style="text-align: center;"><input type="file" name="pano" id="pano" /></p></form></div></div></body></html>

7、全景图预览,如下图所示:

Photo Sphere Viewer使用攻略

8、浏览器兼容性,如下图所示:

Photo Sphere Viewer使用攻略
© 手抄报圈