Skip to content

Instantly share code, notes, and snippets.

View afternoon2's full-sized avatar

Jakub Antolak afternoon2

View GitHub Profile
@afternoon2
afternoon2 / polygonBooleanOps.js
Last active August 18, 2024 02:52
Polygon boolean operations using clipper.js for pen plotting purposes
// this is an old version available on npm and jsdelivr, but you can download
// newer version here: https://sourceforge.net/projects/jsclipper/files/ and keep it
// locally in your project
import ClipperLib from "https://cdn.jsdelivr.net/npm/[email protected]/+esm";
const SUBJECT = ClipperLib.PolyType.ptSubject; // 0
const CLIP = ClipperLib.PolyType.ptClip; // 1
const FILL_NON_ZERO = ClipperLib.PolyFillType.pftNonZero;
const FILL_EVEN_ODD = ClipperLib.PolyFillType.pftEvenOdd;
const DIFFERENCE = ClipperLib.ClipType.ctDifference;
// polygon transform with using svgpathdata.js matrix utility class
// results in the same polygon as in case of using svgpathdata directly
// but without the need of stringifying path data before processing.
// useful when working on polygons data instead of svg paths.
// Input format utilizes JS Clipper Lib polygon format:
// type PolygonRing = { X: number, Y: number }[];
// type Polygon = PolygonRing[];
//
// usage:
I am attesting that this GitHub handle afternoon2 is linked to the Tezos account tz1PJCyGx6h9qidLv8E5ovby5Bbt86JD32ms for tzprofiles
sig:edsigu6rBfJGiqSCKpzQRFBnX9USgA6Mr14YHZbdKdRCuxjxm4dHcP814phXFVJFMHiLyo7SPx8sibe1M3pya52KCYQXGqp2vAL
@afternoon2
afternoon2 / index.html
Created May 23, 2018 20:03
WebGL Hover Effect
<body>
<div class='container'>
<img src='data:image/jpeg;base64,/9j/4QlQaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjYtYzE0MCA3OS4xNjA0NTEsIDIwMTcvMDUvMDYtMDE6MDg6MjEgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiLz4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC
@afternoon2
afternoon2 / glsl-primordial-soup-optimized.markdown
Created May 21, 2018 18:16
GLSL: Primordial Soup (Optimized)

GLSL: Primordial Soup (Optimized)

Fractal noise distortions. Super heavy, will probably not behave nicely on mobile, sorry for that :)

Clicking will increase the number of fractions in the calculation. WARNNG: Only do this is you have a decent GPU :)

A special thanks, as always, to Inigo Quilez and Patricio Gonzalez Vivo. Upon the shoulders of giants, I stand.

Move your mouse to increase the speed of the simulation.

@afternoon2
afternoon2 / color-palette-distribution-for-different-color-spaces.markdown
Created September 22, 2017 13:23
color palette distribution for different color spaces
@afternoon2
afternoon2 / index.pug
Created September 21, 2017 11:33
Vue color picker
#app
picker
@afternoon2
afternoon2 / index.pug
Created August 30, 2017 10:26
Input experiments
#root