How to use geometry - 10 common examples

To help you get started, we’ve selected a few geometry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CarnegieLearning / MathFluency / src / html5 / mathattack / src / main.js View on Github external
preprocessingComplete: function () {
        // Create key bindings
        this.setBinding('ABORT', [27]); // [ESC]
        
        this.addChild({child: this.game});
        
        // Add version number
        var vtag = cocos.nodes.Label.create({string: this.get('version')});
        vtag.set('anchor-point', new geo.Point(0.5, 0.5));
        vtag.set('position', new geo.Point(850, 590));
        this.addChild({child: vtag});
    },
github CarnegieLearning / MathFluency / src / html5 / numberline / src / Claw.js View on Github external
init: function() {
        Claw.superclass.init.call(this, {file: '/resources/Claw.png'});
        
        this.set('anchorPoint', new geo.Point(0.5, 0));
        this.set('position', new geo.Point(20, 0));
        
        // Load animations
        var dir = '/resources/Claw_Animation/Claw_';
        this.loadAnimation('close',   dir + 'Close/Close00',              8, 347, 486, 0.125/8.0);
        this.loadAnimation('grab',    dir + 'Grab/Grab00',               43, 347, 486, 0.500/43.0);
        this.loadAnimation('left',    dir + 'Left/Left00',               22, 347, 486, 0.375/22.0);
        this.loadAnimation('open',    dir + 'Open/Open00',               11, 347, 486, 0.125/11.0);
        this.loadAnimation('right',   dir + 'Right/Right00',             21, 347, 486, 0.375/21.0);
        this.loadAnimation('settleL', dir + 'SettleLeft/SettleLeft00',   15, 347, 486, 0.250/15.0);
        this.loadAnimation('settleR', dir + 'SettleRight/SettleRight00', 16, 347, 486, 0.250/16.0);
    },
github CarnegieLearning / MathFluency / src / html5 / numberline / src / Claw.js View on Github external
init: function() {
        Claw.superclass.init.call(this, {file: '/resources/Claw.png'});
        
        this.set('anchorPoint', new geo.Point(0.5, 0));
        this.set('position', new geo.Point(20, 0));
        
        // Load animations
        var dir = '/resources/Claw_Animation/Claw_';
        this.loadAnimation('close',   dir + 'Close/Close00',              8, 347, 486, 0.125/8.0);
        this.loadAnimation('grab',    dir + 'Grab/Grab00',               43, 347, 486, 0.500/43.0);
        this.loadAnimation('left',    dir + 'Left/Left00',               22, 347, 486, 0.375/22.0);
        this.loadAnimation('open',    dir + 'Open/Open00',               11, 347, 486, 0.125/11.0);
        this.loadAnimation('right',   dir + 'Right/Right00',             21, 347, 486, 0.375/21.0);
        this.loadAnimation('settleL', dir + 'SettleLeft/SettleLeft00',   15, 347, 486, 0.250/15.0);
        this.loadAnimation('settleR', dir + 'SettleRight/SettleRight00', 16, 347, 486, 0.250/16.0);
    },
github CarnegieLearning / MathFluency / src / html5 / numberline / src / Hashmarks.js View on Github external
init: function(loc, cnt) {
        Hashmarks.superclass.init.call(this);
        
        this.location = loc;
        this.set('zOrder', -1);
        
        // Add content if the hashmark is labeled
        if(cnt) {
            this.content = cnt;
            this.content.set('anchorPoint', new geo.Point(0, -0.5));
            this.content.set('position', new geo.Point(0, 24));
            this.content.bgShow = false;
            this.addChild({child: this.content});
        }
    },
github CarnegieLearning / MathFluency / src / html5 / numberline / src / main.js View on Github external
startGame: function () {
        // Schedule per frame update function
        this.scheduleUpdate();
        
        this.onEndOfSet();
        
        this.addChild({child: this.cursor});
        this.cursor.set('position', new geo.Point((this.min_x + this.max_x) / 2, 200 + QuestionSet.NumberLineY));
        this.cursor.set('zOrder', 10);
        
        this.musicMixer.loopSound('music')
        
        this.hud.startGame();
    },
github CarnegieLearning / MathFluency / src / html5 / numberline / src / EndOfGameDisplay.js View on Github external
this.set('elapsedLabel', lbl);
        
        // Displays time elapsed
        opts['string'] = '0.0';
        lbl = cocos.nodes.Label.create(opts);
        lbl.set('position', new geo.Point(390, 100));
        lbl.set('anchorPoint', new geo.Point(1, 0.5));
        this.set('elapsedTime', lbl);
        
        this.lines = [];
        this.lines[0] = TotalLine.create('Perfect', lineVals[0], Q.bandPts[0]);
        this.lines[1] = TotalLine.create('Almost' , lineVals[1], Q.bandPts[1]);
        this.lines[2] = TotalLine.create('Miss'   , lineVals[2], Q.bandPts[2]);
        
        for(var i=0; i<3; i+=1) {
            this.lines[i].set('position', new geo.Point(30, 120 + 30*i));
            events.addListener(this.lines[i], 'animationCompleted', this.next.bind(this));
            this.addChild({child: this.lines[i]});
        }

        // Holds overall total
        opts['string'] = '0';
        lbl = cocos.nodes.Label.create(opts);
        lbl.set('position', new geo.Point(390, 220));
        lbl.set('anchorPoint', new geo.Point(1, 0.5));
        this.set('totalLabel', lbl);
        
        var dir = '/resources/Score_Card/Window_MedalGained/Window_MedalGained_';
        this.metalTextures = [
            cocos.nodes.Sprite.create({file: dir + 'Gold.png'}),
            cocos.nodes.Sprite.create({file: dir + 'Silver.png'}),
            cocos.nodes.Sprite.create({file: dir + 'Bronze.png'}),
github CarnegieLearning / MathFluency / src / html5 / racecar / src / main.js View on Github external
addRetryButton: function() {
        var dir = '/resources/Buttons/buttonRetry';
        var opts = Object();
        opts['normalImage']   = dir + 'Normal.png';
        opts['selectedImage'] = dir + 'Click.png';
        opts['disabledImage'] = dir + 'Normal.png';
        opts['callback'] = this.retryLevel.bind(this)
        
        this.retryButton = new cocos.nodes.MenuItemImage(opts);
        this.retryButton.position = new geo.Point(0, -225);
        
        this.menu.addChild({child: this.retryButton});
    },
github CarnegieLearning / MathFluency / src / html5 / racecar / src / Player.js View on Github external
changeSelectorByForce: function(selector) {
        var x = selector.contentSize.width / 2 * selector.scaleX;
        
        selector.position = new geom.Point(x, -80);
        selector.bgShow = false;
        this.selectorX = x;
        this.selectorY = -80;
        this.addChild({child: selector});
        this.selector = selector;
        selector.addChild({child: this.selectorBG});
    },
github CarnegieLearning / MathFluency / src / html5 / racecar / src / EndOfGameDisplay.js View on Github external
buildLabel: function(n, x, y, s, fs, fc) {
        var temp = new cocos.nodes.Label({string: s, fontName: RC.font, fontSize: fs, fontColor: fc});
        temp.anchorPoint = new geo.Point(1, 0);
        temp.position = new geo.Point(x, y);
        this.addChild({child: temp});
        this[n] = temp;
    },

geometry

JavaScript library for working with objects in a two-dimensional coordinate system.

MIT
Latest version published 13 years ago

Package Health Score

42 / 100
Full package analysis

Popular geometry functions