Skip to content

Instantly share code, notes, and snippets.

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

Pedro sketchpunk

🏠
Working from home
View GitHub Profile
@sketchpunk
sketchpunk / Timeline.js
Created May 27, 2020 23:10
Animation Timeline Web Component
let $config = {
bg_color : "#424242",
div_color : "#323232",
sub_div_color : "#383838",
txt_color : "#c0c0c0",
marker_color : "#00ffff",
};
class Timeline extends HTMLElement{
constructor(){
@sketchpunk
sketchpunk / gtlf.js
Created May 16, 2020 03:18
GLTF Geometry Loading
class Gltf{
static TYPE_BYTE = 5120;
static TYPE_UNSIGNED_BYTE = 5121;
static TYPE_SHORT = 5122;
static TYPE_UNSIGNED_SHORT = 5123;
static TYPE_UNSIGNED_INT = 5125;
static TYPE_FLOAT = 5126;
static MODE_POINTS = 0; // Mode Constants for GLTF and WebGL are identical
static MODE_LINES = 1; // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
@sketchpunk
sketchpunk / ScrollToElement.html
Created April 20, 2020 20:50
Scroll to an Element on a page.
<!DOCTYPE html>
<html>
<head>
<title>Scroll</title>
</head>
<body>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div name="spot">001</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
@sketchpunk
sketchpunk / EventManager.js
Last active April 18, 2020 16:47
Event Manager - Handle Instant Event Broadcasting or Queue to Manual Broadcast
let e = new EventManager();
let xxx = (x)=>console.log("x",x);
// EVENT NAME, SIZE, ALLOW_LISTENERS
// Size = 0, Event will broadcast instantly
// Size = 1, Single Item Event Queue, Manaual Broadcast
// Size > 1, Ring Event Queue, Manual Broadcast
e.reg( "test", 1, true );
// Assign Listeners
@sketchpunk
sketchpunk / Router.js
Last active April 22, 2020 15:58
Simple Javascript Router
/*
Router.on( "/page/:id/:other", ( params )=>{
console.log( "Param Test", params );
document.getElementById("lbl").innerHTML = params.id + "-" + params.other;
});
Router.on( "/page/test", ( params )=>{
console.log( "test", params );
document.getElementById("lbl").innerHTML = "Test";
});
https://manga.madokami.al/Manga/B/BE/BEAS/Beastars
https://mangadex.org/title/16411/enen-no-shouboutai
https://ww2.mangacruzers.com/hajimete-no-gal-manga-chapter-69-download/
http://manga.watchgoblinslayer.com/manga/goblin-slayer-side-story-year-one/
http://manga.watchgoblinslayer.com/
https://ww2.mangacruzers.com/tag/monster-musume-no-iru-nichijou-manga/
https://mangadex.org/title/16444/radiant
https://ww5.readmha.com/manga/vigilante-boku-no-hero-academia-illegals/
@sketchpunk
sketchpunk / VarBuffer.js
Created March 6, 2020 21:16
VarBuffer.js - Field Access to slices from Byte Array, useful to manage UBOs for WebGL or WebGPU
/*
let b = VarBuffer.config([
{ name:"num", type:"int32", size:1 }, // Int
{ name:"pos", type:"float", size:3 }, // Vec3
{ name:"scale", type:"float", size:1 }, // Float
{ name:"sign", type:"uint32", size:1 }, // Test Unsign
]);
b.pos[0] = 0.5;
b.pos[2] = 2.5;
@sketchpunk
sketchpunk / Drag.js
Created March 4, 2020 21:49
Global Drag handler
class Drag{
static MOVE = 1;
static END = 0;
static elm = null;
static callback = null;
static offset_x = 0;
static offset_y = 0;
static move_bind = Drag.move.bind( Drag );
@sketchpunk
sketchpunk / color_webgl.js
Last active February 3, 2020 17:46
Colour.js
/*
console.log( new Color() ); // Test Blank
console.log( new Color( 0xff00ff ) ); // Test Number form
console.log( new Color( 100, "200", 300 ) ); // Test RGB, String and Overflow
console.log( new Color( "#f50" ) ); // Test Short Hand Hex
console.log( new Color( "#ff00ff" ) ); // Test Hex
console.log( new Color( "red" ) ); // Test Color Names
console.log( new Color( "w00t" ) ); // Test Unknown Color name
*/
@sketchpunk
sketchpunk / vscode_settings.json
Last active February 6, 2020 15:55
Visual Studio Code User Settings
{
"breadcrumbs.enabled": true,
"scm.diffDecorations":"overview",
"html.mirrorCursorOnMatchingTag": false,
"fontshortcuts.defaultFontSize":15,
"fontshortcuts.defaultTerminalFontSize": 15,
"fontshortcuts.step": 1,
"editor.minimap.enabled": false,