Skip to content

Commit 173af7c

Browse files
committed
SOF-7354: more experiment with colors x3
1 parent 144e039 commit 173af7c

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/mixins/atoms.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,16 @@ export const AtomsMixin = (superclass) =>
104104
const atomHSL = {};
105105
new THREE.Color(atomColor).getHSL(atomHSL);
106106
const label = parseInt(atomicLabelsArray[atomicIndex], 10) || 0;
107-
let hue;
107+
let hue, saturation;
108108
if (label !== 0) {
109109
if (label % 2 === 0) {
110110
// even labels
111111
hue = atomHSL.h + (label * 0.1) / 2;
112+
saturation = atomHSL.s + (label * 0.1) / 2;
112113
} else {
113114
// odd labels
114115
hue = atomHSL.h - ((label + 1) * 0.1) / 2;
116+
saturation = atomHSL.s - ((label + 1) * 0.1) / 2;
115117
}
116118

117119
// hue is cyclic
@@ -123,9 +125,10 @@ export const AtomsMixin = (superclass) =>
123125
hue += 1;
124126
}
125127

128+
saturation = Math.max(0, Math.min(1, saturation));
126129
new THREE.Color(atomColor).setHSL(atomHSL);
127130
sphereMesh.material.emissiveIntensity = 0.25;
128-
sphereMesh.material.emissive.setHSL(hue, atomHSL.s, atomHSL.l);
131+
sphereMesh.material.emissive.setHSL(hue, saturation, atomHSL.l);
129132
}
130133
atomsGroup.add(sphereMesh);
131134
});
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)