颜色修改

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

File diff suppressed because it is too large Load Diff