three实现三维立体被切成片的小球代码
代码语言:html
所属分类:三维
代码描述:three实现三维立体被切成片的小球代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
html, body {
padding: 0;
margin: 0;
}
body {
background-color: #4C22AB;
margin: 0;
}
</style>
</head>
<body translate="no">
<script type="importmap">
{
"imports": {
"three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/171/three.module.js",
"three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/171/jsm/"
}
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
varying vec2 vUv;
varying vec3 vPos;
varying vec3 vNormal;
//varying vec4 vViewMatrix;
uniform float time;
void main(){
float l = length(vPos);
if(l<1.){
l=1.;
}else{
l=0.;
}
float height = (2. * (vPos.y+1.)/2.)-0.2;
//height = (2.*height)+0.5;
//height = 0.3*pow(height,2.) + 0.2*height;
//height = height + 0.5.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0