three+oimo实现三维篮球场投篮得分代码

代码语言:html

所属分类:三维

代码描述:three+oimo实现三维篮球场投篮得分代码,点击鼠标左键投篮。

代码标签: three oimo 三维 篮球 投篮 得分 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
 
<meta charset="UTF-8">

 
 
 
<style>
@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed|Playfair+Display:700i|Didact+Gothic');
     html
,body{
     
overflow: hidden;
     
background:black;
   
     
font-family: monospace;
     
font-family: 'Roboto', sans-serif;
     
}
      html
{
       
box-sizing: border-box;
     
}
     
*, *:before, *:after {
       
box-sizing: inherit;
     
}
     
*{
       
margin:0;
       
padding: 0;
     
}
      h1
{
       
font-family: "Roboto Condensed", "Helvetica Neue", Helvetica, Arial, sans-serif;
       
font-size: 30px;
       
line-height: 1;
     
}
   
       section
{
         
color: white;
         
max-width: 275px;
         
width: 100%;
         
display: none;
         
font-size: 14px
       
}
        p
{
         
color: rgba(255,255,255,0.5);
       
}
        a
{
         
color: white;
       
}
   
        span
.low{
         
color: #a32e2c;
       
}
       
.btn-group{
         
display: flex;
         
-webkit-display: flex;
         
justify-content: space-between;
         
-webkit-justify-content: space-between;
         
width: 100%;
         
padding: 50px 25px;
         
position: absolute;
         
left: 0;
         
bottom: 0;
         
visibility: hidden;
       
}
       
.btn-group span{
         
width: 75px;
         
height: 75px;
         
border-radius: 50%;
         
background: white;
         
background: #222;
         
color: white;
         
text-align: center;
         
display: flex;
         
-webkit-display: flex;
         
align-items: center;
         
-webkit-align-items: center;
         
justify-content: center;
         
-webkit-justify-content: center;
         
font-weight: bold;
         
font-size: 30px;
         
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.5);
       
}

       
#VR {
         
position: fixed;
         
top: 20px;
         
right: 20px;
         
outline: none;
         
border: none;
         
width: 60px;
         
height: 40px;
         
z-index: 100;
         
background: rgba(135,206,250,0.75);
         
display: flex;
         
-webkit-display: flex;
         
justify-content: center;
         
-webkit-justify-content: center;
         
align-items: center;
         
-webkit-align-items: center;
         
visibility: hidden;
       
}

       
#VR svg {
         
width: 60px;
         
height: 35px;
         
transform: scale(2);
         
-webkit-transform: scale(2);
         
fill: white;
       
}
        button
{
         
background: none;
         
border:none;
       
}

       
button:hover {
         
cursor: pointer;
       
}
        button
#start{
         
color:white;
         
border: 2px solid white;
         
padding: 10px 20px;
         
font-weight: bold;
         
font-family: "Roboto Condensed", "Helvetica Neue", Helvetica, Arial, sans-serif;
         
font-size: 18px;
         
margin: 10px 0;
       
}

     
@media (min-width: 1300px){
        section
{
         
display: block;
         
position: absolute;
         
top: 50px;
         
left: 50px;
       
}
     
}


   
/* Show only on touchscreen devices */
   
@media (pointer: coarse) {
     
.btn-group, #VR{
         
visibility: visible;
       
}
       
.hide{
           
visibility: hidden;
       
}
   
}
</style>


 
 
</head>

<body translate="no">
 
<button id='VR' class='button toggleVR' onclick='toggleVR()' title='Toggle VR Mode for Mobile Devices Only'>
   
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="-12 -12 48 48"><path fill="#fff" d="M23.058 5.038H.942c-.522 0-.942.422-.942.94V18.02c0 .522.423.942.942.942H8.8c.26 0 .492-.174.564-.425.88-3.028 1.062-4.754 2.724-4.754 1.66 0 1.905 1.973 2.685 4.766.068.243.29.41.543.41h7.743c.52 0 .94-.424.94-.943V5.982c0-.522-.42-.944-.942-.944zm-16.43 9.467c-1.384 0-2.504-1.12-2.504-2.504s1.12-2.503 2.504-2.503 2.5 1.12 2.5 2.504-1.12 2.505-2.5 2.505zm10.744 0c-1.384 0-2.504-1.12-2.504-2.504s1.12-2.503 2.504-2.503c1.383 0 2.504 1.12 2.504 2.504s-1.12 2.505-2.504 2.505z"/></svg>
 
</button>



<section>
 
<h1 id="title">Click<span class="low">To</span>Shoot</h1>
 
<p>move and click mouse to shoot</p>
 
<p>Score:<small>0<small></p>
</section>


 
<div class="btn-group">
   
<span>RL</span>
   
<span>RR</span>
 
</div>




<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.124.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jsonloader.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/DeviceOrientationControls.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/StereoEffect.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/TweenMax.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/Projector.126.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/oimo.1.0.9.js"></script>
 
     
<script >
const randnum = (min, max) => Math.round(Math.random() * (max - min) + min);

//=========================================================================================== scene
var scene = new THREE.Scene();

//=========================================================================================== camera
var camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 10000);


//=========================================================================================== canvas
renderer = new THREE.WebGLRenderer({
  alpha: true,
  antialias: true });

renderer.setSize(window.innerWidth, window.innerHeight);
renderer.shadowMapEnabled = true; //Shadow
renderer.shadowMapSoft = true; // Shadow
renderer.shadowMapType = THREE.PCFShadowMap; //Shadow
document.body.appendChild(renderer.domElement);

//=========================================================================================== add VR
renderer.setPixelRatio(window.devicePixelRatio); //VR
var effect = new THREE.StereoEffect(renderer); //VR
effect.setSize(window.innerWidth, window.innerHeight); //VR
var VR = false;

function toggleVR() {
  if (VR) {
    VR = false;
    camera.rotation.reorder('ZYX');
    camera.lookAt(0, 0, 0);
  } else {
    VR = true;
    controls = new THREE.DeviceOrientationControls(camera);
    requestFullscreen(document.documentElement);
  }
  renderer.setSize(window.innerWidth, window.innerHeight);
}



//=========================================================================================== post processing
/* var renderScene = new THREE.RenderPass(scene, camera);

  var effectFXAA = new THREE.ShaderPass(THREE.FXAAShader);
  effectFXAA.uniforms['resolution'].value.set(1 / window.innerWidth, 1 / window.innerHeight );

  var copyShader = new THREE.ShaderPass(THREE.CopyShader);
  copyShader.render.........完整代码请登录后点击上方下载按钮下载查看

网友评论0