index.js
/**
     * Init scene what means creation of circles, squares and lines
     */
Init scene what means creation of circles, squares and lines
Init scene what means creation of circles squares and lines
function initialize(){
        line = new Graphics();
        userLineContainer.addChild(line);
        for (let i = 0; i < CIRCLE_COUNT; i++) {
            for (let j = 0; j < CIRCLE_COUNT; j++) {
                let circle = new Circle((i * CIRCLE_COUNT + j), 0xffffff, 50 + j * CIRCLE_DISTANCE , 50 + i * CIRCLE_DISTANCE, 24, CIRCLE_COUNT, render);
                circle.on('mousedown', onCircleMouseDown);
                circleContainer.addChild(circle);
                circles.push(circle);
            }
        }
        for (let i = 0; i < 2 * CIRCLE_COUNT * (CIRCLE_COUNT - 1); i++) {
            let line = new Line(i, 0x000000, CIRCLE_COUNT, {'x' : 50, 'y' : 50}, CIRCLE_DISTANCE);
            linesContainer.addChild(line);
            lines.push(line);
        }
        for (let i = 0; i < CIRCLE_COUNT - 1; i++) {
            for (let j = 0; j < CIRCLE_COUNT - 1; j++) {
                let square = new Square((i * (CIRCLE_COUNT - 1) + j), [0xffffff, 0xf1c40f, 0x9966FF], {'x' : 50, 'y' : 50}, CIRCLE_COUNT, CIRCLE_DISTANCE);
                squaresContainer.addChild(square);
                squares.push(square);
            }
        }
        render();
    }
function initialize ( ) { line = new Graphics ( ) ; userLineContainer . addChild ( line ) ; for ( let i = 0 ; i < CIRCLE_COUNT ; i ++ ) { for ( let j = 0 ; j < CIRCLE_COUNT ; j ++ ) { let circle = new Circle ( ( i * CIRCLE_COUNT + j ) , 0xffffff , 50 + j * CIRCLE_DISTANCE , 50 + i * CIRCLE_DISTANCE , 24 , CIRCLE_COUNT , render ) ; circle . on ( 'mousedown' , onCircleMouseDown ) ; circleContainer . addChild ( circle ) ; circles . push ( circle ) ; } } for ( let i = 0 ; i < 2 * CIRCLE_COUNT * ( CIRCLE_COUNT - 1 ) ; i ++ ) { let line = new Line ( i , 0x000000 , CIRCLE_COUNT , { 'x' : 50 , 'y' : 50 } , CIRCLE_DISTANCE ) ; linesContainer . addChild ( line ) ; lines . push ( line ) ; } for ( let i = 0 ; i < CIRCLE_COUNT - 1 ; i ++ ) { for ( let j = 0 ; j < CIRCLE_COUNT - 1 ; j ++ ) { let square = new Square ( ( i * ( CIRCLE_COUNT - 1 ) + j ) , [ 0xffffff , 0xf1c40f , 0x9966FF ] , { 'x' : 50 , 'y' : 50 } , CIRCLE_COUNT , CIRCLE_DISTANCE ) ; squaresContainer . addChild ( square ) ; squares . push ( square ) ; } } render ( ) ; }
Init scene what means creation of circles, squares and lines
Init scene what means creation of circles squares and lines
// Init user line // Create circles // Create lines // Create squares //showLinesWeight();