在乳膠中,我可以混合兩種顏色,例如RoyalBlue!25!white
.在漸近線中我想使用相同的顏色。我該怎麼做呢?
MWE,我想用上面的顏色替換材料的 RoyalBlue 顏色:
size(700);
import solids;
import texcolors;
import three;
currentprojection=orthographic (
camera=(8,4,4),
up=(0,0,1),
target=(2,2,2),
zoom=1.0
);
// save predefined 2D orientation vectors
pair NN=N;
pair SS=S;
pair EE=E;
pair WW=W;
triple Atom1 = (-1.1547, -2., 3.26599);
material m = material(gray(0.5), black, RoyalBlue, black);
draw(surface(sphere(Atom1,0.5)),m);
答案1
使用二元運算子*
縮放顏色/筆,並使用二元運算子+
將顏色/筆加在一起。
因此,替換RoyalBlue
為RoyalBlue*0.25 + white*0.75
(25% 皇家藍與 75% 白色混合)應該會產生您想要的輸出。
size(700);
import solids;
import texcolors;
import three;
currentprojection=orthographic (
camera=(8,4,4),
up=(0,0,1),
target=(2,2,2),
zoom=1.0
);
// save predefined 2D orientation vectors
pair NN=N;
pair SS=S;
pair EE=E;
pair WW=W;
triple Atom1 = (-1.1547, -2., 3.26599);
material m = material(gray(0.5), black, RoyalBlue*0.25 + white*0.75, black);
draw(surface(sphere(Atom1,0.5)),m);