Skip to content

Instantly share code, notes, and snippets.

View JoeCrash's full-sized avatar
🏠
Working from home

Juan Medina JoeCrash

🏠
Working from home
  • New York, USA
  • 22:58 (UTC -04:00)
View GitHub Profile
PIXI.Graphics.prototype.drawDashLine = function(toX, toY, dashPct = 7, gapPct = 3) {
const lastPosition = this.currentPath.points;
let ax = lastPosition[lastPosition.length - 2] || 0;
let ay = lastPosition[lastPosition.length - 1] || 0;
let pctAt = dashPct;
while(pctAt < 101){
let p = getCoordsAlongPath([ay,ax,toY,toX], pctAt);
let pd = getCoordsAlongPath([ay,ax,toY,toX], pctAt + gapPct);
this.lineTo(p.lng, p.lat);
this.moveTo(pd.lng, pd.lat);
@JoeCrash
JoeCrash / pixi5-dashed-lines.js
Last active December 9, 2020 19:10
Pixi.js 5 - Draw Dashed Lines using dash/gap points
PIXI.Graphics.prototype.drawDashLine = function(toX, toY, dash = 7, gap = 3) {
//TYPE B. actual points
const lastPos = this.currentPath.points;
let ax = lastPos[lastPos.length - 2] || 0;
let ay = lastPos[lastPos.length - 1] || 0;
let xlen = toX - ax;
let ylen = toY - ay;
let lineLen = getDistanceBetweenPoints(ax, ay, toX, toY);
let totalDashes = lineLen / (dash + gap);
let dashes = 0;
@JoeCrash
JoeCrash / gist:7d7b553288395181bca4d5d705665814
Created March 7, 2019 19:34
Get web user information on Windows.
$out = array();
exec('cmd /c whoami 2>&1', $out, $exitcode);
print_r($out);