Skip to content

Instantly share code, notes, and snippets.

@dashawk
Created July 19, 2018 00:24
Show Gist options
  • Save dashawk/ce37ead1f926de5c3e7d6799e5b633a7 to your computer and use it in GitHub Desktop.
Save dashawk/ce37ead1f926de5c3e7d6799e5b633a7 to your computer and use it in GitHub Desktop.

Revisions

  1. dashawk created this gist Jul 19, 2018.
    8 changes: 8 additions & 0 deletions scale-factor-points.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    var points = [{x:1,y:1}, {x:2,y:5}, {x:3,y:1}];
    var scaleFactor = canvas2width/canvas1width;
    var scaledPoints = points.map(function(p) {
    return {
    x:p.x*scaleFactor,
    y:p.y*scaleFactor
    };
    });