颜色修改

This commit is contained in:
nicomacbookpro
2025-08-20 15:19:33 +08:00
parent fb2b8515ee
commit 120f31aa9e
2 changed files with 1919 additions and 1884 deletions

View File

@@ -35,7 +35,7 @@ import { TextGeometry } from "three/examples/jsm/geometries/TextGeometry.js"; //
function createDashedLinesForBall( function createDashedLinesForBall(
ball, ball,
scene, scene,
{ dashSize = 1, gapSize = 1, color = 0x7ec8ff, arrowSize=1 } = {} { dashSize = 1, gapSize = 1, color = 0x7ec8ff, arrowSize = 1 } = {}
) { ) {
const makeLine = (direction) => { const makeLine = (direction) => {
// 用 BufferGeometry+LineDashedMaterial 创建一条虚线 // 用 BufferGeometry+LineDashedMaterial 创建一条虚线
@@ -75,7 +75,7 @@ function createDashedLinesForBall(
arrowHelper.line.material.opacity = 0.6; arrowHelper.line.material.opacity = 0.6;
// 设置箭头头部透明度 // 设置箭头头部透明度
arrowHelper.cone.material = new THREE.MeshBasicMaterial({ arrowHelper.cone.material = new THREE.MeshBasicMaterial({
color: color, color: "#00ff00",
transparent: true, // 必须设置为true transparent: true, // 必须设置为true
opacity: 0.6, // 与线段相同的透明度 opacity: 0.6, // 与线段相同的透明度
}); });
@@ -179,7 +179,7 @@ function updateDashedLines(ball) {
// 更新后方向虚线及箭头 // 更新后方向虚线及箭头
updateLineAndArrow( updateLineAndArrow(
dashedLines.back, dashedLines.back,
[ballPos.x, ballPos.y, ballPos.z-1 ], [ballPos.x, ballPos.y, ballPos.z - 1],
[ballPos.x, ballPos.y, 0], // 假设后面在z=0 [ballPos.x, ballPos.y, 0], // 假设后面在z=0
radius radius
); );
@@ -633,8 +633,8 @@ export function drawAxes(element, options = {}, ballCallBack) {
styleGroups[el.name] = null; styleGroups[el.name] = null;
}); });
styleGroups["灰球"] = null; styleGroups["灰球"] = null;
const geometryColors = [ const lineGeometryColors = [
"#f617d9", "#0x00ff00",
"#779c6e", "#779c6e",
"#3ee4bc", "#3ee4bc",
"#ca41e7", "#ca41e7",
@@ -642,6 +642,15 @@ export function drawAxes(element, options = {}, ballCallBack) {
"#7467ef", "#7467ef",
"#c7bef7", "#c7bef7",
]; ];
const geometryColors = [
"#888888",
"#888888",
"#888888",
"#888888",
"#888888",
"#888888",
"#888888",
];
const ballScene = new THREE.Group(); const ballScene = new THREE.Group();
geometryColors.forEach((el) => { geometryColors.forEach((el) => {
// 几何体 // 几何体
@@ -718,7 +727,7 @@ export function drawAxes(element, options = {}, ballCallBack) {
createDashedLinesForBall(n, scene, { createDashedLinesForBall(n, scene, {
dashSize: 1, dashSize: 1,
gapSize: 1, gapSize: 1,
color: geometryColors[idx], color: lineGeometryColors[idx],
arrowSize: 8, arrowSize: 8,
}); // 给每个球加三条投影虚线 }); // 给每个球加三条投影虚线
updateDashedLines(n); updateDashedLines(n);
@@ -749,7 +758,7 @@ export function drawAxes(element, options = {}, ballCallBack) {
createDashedLinesForBall(ball, scene, { createDashedLinesForBall(ball, scene, {
dashSize: 1, dashSize: 1,
gapSize: 1, gapSize: 1,
color: geometryColors[modelIndex], color: lineGeometryColors[modelIndex],
}); });
updateDashedLines(ball); updateDashedLines(ball);
} }
@@ -1204,7 +1213,7 @@ export function drawAxes(element, options = {}, ballCallBack) {
// 创建坐标轴 // 创建坐标轴
async function addPositiveAxes(scene,sizeX, sizeY,sizeZ) { async function addPositiveAxes(scene, sizeX, sizeY, sizeZ) {
// 创建X轴红色只显示正向 // 创建X轴红色只显示正向
const xAxis = new THREE.ArrowHelper( const xAxis = new THREE.ArrowHelper(

File diff suppressed because it is too large Load Diff