three+tone实现多种三维图形变换屏保动画效果代码
代码语言:html
所属分类:动画
代码描述:three+tone实现多种三维图形变换屏保动画效果代码,可以选择不同的shape和颜色配置,还可以设置具体动画参数。
代码标签: three tone 多种 三维 图形 变换 屏保 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
font-family: Arial, sans-serif;
background: #000;
color: #fff;
}
.settings-panel {
position: fixed;
top: 70px;
right: -300px; /* Start off-screen */
width: 300px;
height: 100%;
background: rgba(0, 0, 0, 0.8);
transition: right 0.3s ease-in-out;
overflow-y: auto;
z-index: 1000;
padding: 20px;
box-sizing: border-box;
}
.settings-panel.open {
left: 0;
}
.settings-toggle {
position: fixed;
top: 10px;
left: 10px;
background: none;
border: none;
color: white;
font-size: 24px;
cursor: pointer;
z-index: 1001;
opacity: 0.7;
transition: opacity 0.3s;
}
.settings-toggle:hover {
opacity: 1;
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
button:hover {
background-color: #45a049;
}
button:disabled {
background-color: #cccccc;
cursor: not-allowed;
}
.fullscreen-button {
width: 100%;
margin-bottom: 20px;
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
.fullscreen-button:hover {
background-color: #45a049;
}
.randomize-button {
width: 100%;
margin-bottom: 20px;
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: block;
font-size: 16px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}
.randomize-button:hover {
background-color: #45a049;
}
.slider {
-webkit-appearance: none;
width: 100%;
height: 15px;
border-radius: 5px;
background: #d3d3d3;
outline: none;
opacity: 0.7;
transition: opacity .2s;
margin: 10px 0;
}
.slider:hover {
opacity: 1;
}
.slider::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
.slider::-moz-range-thumb {
width: 25px;
height: 25px;
border-radius: 50%;
background: #4CAF50;
cursor: pointer;
}
#tempoValue, #speedValue, #rotationValue, #colorCycleSpeedValue, #colorIntensityValue, #zoomValue, #teleidoscopeSidesValue, #teleidoscopeRotationSpeedValue, #edgeThicknessValue, #starEdgeLengthValue, #starEdgeAngleValue, #distortionAmountValue, #distortionSpeedValue {
display: inline-block;
width: 50px;
text-align: right;
}
</style>
</head>
<body translate="no">
<div id="settingsPanel" class="settings-panel">
<div id="settingsContent">
<div>
<button id="fullscreenToggle" class="fullscreen-button">Toggle Fullscreen</button>
<button id="randomizeButton" class="randomize-button">Randomize All Settings</button>
</div>
<div>
<label for="shapeSelect">Shape:</label>
<select id="shapeSelect">
<option value="circle">Circle</option>
<option value="square">Square</option>
<option value="triangle" selected>Triangle</option>
<option value="pentagram">Pentagram</option>
<option value="heptagram">Heptagram</option>
<option value="octagram">Octagram</option>
<option value="enneagram">Enneagram</option>
<option value="decagram">Decagram</option>
<option value="hendecagram">Hendecagram</option>
<option value="dodecagram">Dodecagram</option>
</select>
</div>
<div>
<label for="colorGroup">Color Group:</label>
<select id="colorGroup">
<option value="group1" selected>Vibrant Red-Blue</option>
<option value="group2">Sunset Ocean</option>
<option value="group3">Neon Spectrum</option>
<option value="group4">Nature Pop</option>
<option value="group5">Citrus Twilight</option>
<option value="group6">Forest Glow</option>
<option value="group7">Candy Cosmos</option>
<option value="group8">Royal Prism</option>
<option value="custom">Custom</option>
</select>
</div>
<div id="customColorInputs" style="display: none;">
<input type="color" id="customColor1" value="#FF0000">
<input type="color" id="customColor2" value="#00FFFF">
<input type="color" id="customColor3" value="#FFFF00">
<input type="color" id="customColor4" value="#0000FF">
</div>
<div>
<label for="randomizeColors">Randomize Colors:</label>
<input type="checkbox" id="randomizeColors" checked>
</div>
<div>
<label for="enableTeleidoscope">Enable Teleidoscope:</label>
<input type="checkbox" id="enableTeleidoscope">
</div>
<div>
<label for="speed">Speed: <span id="speedValue">1</span></label>
<input type="range" min="0" max="5" value="1" step="0.1" class="slider" id="speed">
</div>
<div>
<label for="rotation">Rotation: <span id="rotationValue">1.5</span></label>
<input type="range" min="0" max="5" value="1.5" step="0.1" class="slider" id="rotation">
</div>
<div>
<label for="colorCycleSpeed">Color Cycle Speed: <span id="colorCycleSpeedValue">0.8</span></label>
<input type="range" min="0" max="10" value="0.8" step="0.1" class="slider" id="colorCycleSpeed">
</div>
<div>
<label for="colorIntensity">Color Intensity: <span id="colorIntensityValue">0.2</span></label>
<input type="range" min="0" max="2" value="0.2" step="0.1" class="slider" id="colorIntensity">
</div>
<div>
<label for="zoom">Zoom: <span id="zoomValue">1</span></label>
<input type="range" min="0.1" max="5" value="1" step="0.1" class="slider" id="zoom">
</div>
<div>
<label for="teleidoscopeSides"># of Sides: <span id="teleidoscopeSidesValue">10</span></label>
<input type="range" min="3" max="12" value="10" step="1" class="slider" id="teleidoscopeSides">
</div>
<div>
<label for="teleidoscopeRotationSpeed">Spin: <span id="teleidoscopeRotationSpeedValue">-1.5</span></label>
<input type="range" min="-5" max="5" value="-1.5" step="0.1" class="slider" id="teleidoscopeRotationSpeed">
</div>
<div>
<label for="edgeThickness">Edge Thickness: <span id="edgeThicknessValue">0.050</span></label>
<input type="range" min="0" max="0.5" value="0.050" step="0.001" class="slider" id="edgeThickness">
</div>
<div>
<label for="starEdgeLength">Star Edge Length: <span id="starEdgeLengthValue">-0.52</span></label>
<input type="range" min="0.1" max="5" value="-0.52" step="0.1" class="slider" id="starEdgeLength">
</div>
<div>
<label for="starEdgeAngle">Star Edge Angle: <span id="starEdgeAngleValue">-0.6</span></label>
<input type="range" min="-1" max="1" value="-0.6" step="0.01" class="slider" id="starEdgeAngle">
</div>
<div>
<label for="distortionAmount">Distortion Amount: <span id="distortionAmountValue">0.1</span></label>
<input type="range" min="0" max="1" value="0.1" step="0.01" class="slider" id="distortionAmount">
</div>
<div>
<label for="distortionSpeed">Distortion Speed: <span id="distortionSpeedValue">2</span></label>
<input type="range" min="0" max="5" value="2" step="0.1" class="slider" id="distortionSpeed">
</div>
<div>
<label for="randomizeTime">Randomize Change Time: <span id="randomizeTimeValue">15</span> seconds</label>
<input type="range" min="5" max="300" value="15" class="slider" id="randomizeTime">
</div>
</div>
</div>
<button id="settingsToggle" class="settings-toggle">⚙️</button>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/Tone.min.js"></script>
<script id="vertexShader" type="x-shader/x-vertex">
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = vec4(position, 1.0);
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
uniform vec2 iResolution;
uniform float iTime;
uniform float speed;
uniform float rotation;
uniform float colorCycleSpeed;
uniform float colorIntensity;
uniform bool enableTeleidoscope;
uniform float zoom;
uniform int teleidoscopeSides;
uniform float teleidoscopeRotationSpeed;
uniform int shapeType;
uniform float edgeThickness;
uniform float starEdgeLength;
uniform float star.........完整代码请登录后点击上方下载按钮下载查看
网友评论0