UNPKG

neuralaesthetics

Version:

Awesome neural networks for aesthetic web pages

38 lines (37 loc) 939 B
export const generateNeuron = () => { let neuron = { index: -1, originalPosX: 0, originalPosY: 0, posX: 0, posY: 0, newPosX: 0, newPosY: 0, radius: 20, strokeWidth: 1.5, strokeColor: "white", bgColor: "black", flags: {}, }; return neuron; }; export const generateConnProps = () => { let connection = { index: -1, idxNeuron1: -1, idxNeuron2: -1, strokeColor: "white", strokeWidth: 2, strokeOpacity: 1, }; return connection; }; export const assignRandomPositions = (neuronsList, minX, maxX, minY, maxY) => { for (let neuron of neuronsList) { neuron.posX = rand(minX, maxX); neuron.posY = rand(minY, maxY); } }; export const rand = (min, max) => { return Math.floor(Math.random() * (max - min + 1) + min); };