add opacity to nodeview for strangeness repr

This commit is contained in:
axolotle
2021-06-29 13:05:43 +02:00
parent 02545bf081
commit edbb45878d
3 changed files with 24 additions and 4 deletions
+9
View File
@@ -146,3 +146,12 @@ export function getRelation (node) {
}
return { parentId: node.id }
}
export function getStrangenessOpacity (currentStrangeness, node) {
if (currentStrangeness === undefined) return 1
const strangeness = (
node.type === 'prod' && node.parents && node.parents.length ? node.parents[0] : node
).strangeness
return 1 / (Math.abs(strangeness - currentStrangeness) + 1)
}