This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Dichroic Glass X-Cube Optical Prism with Interactive Drag-to-Rotate | |
| // Built using Three.js inside Instacode Web Worker | |
| import { canvas, onResize, getDisplaySize, onPointerDown, onPointerMove, onPointerUp } from 'canvas'; | |
| import * as THREE from 'three'; | |
| // ========================================== | |
| // CONFIGURATION CONSTANTS (Adjust these to customize your X-Cube!) | |
| // ========================================== | |
| const BG_COLOR = 0xf3f2f8; // Soft light studio background color (#f3f2f8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Glassmorphism 3D Rotating Cube for Instacode | |
| // Features: Dual-cube perspective engine, global depth sorting, Phong lighting, and specular glass gradients | |
| import { canvas, getContext, onResize } from 'canvas'; | |
| const ctx = getContext('2d'); | |
| let width = 600; | |
| let height = 400; | |
| // Handle canvas resizing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Mandelbrot Explorer for Instacode | |
| // Features: Smooth zoom animation, continuous coloring, and HUD info display | |
| import { canvas, getContext, onResize } from 'canvas'; | |
| const ctx = getContext('2d'); | |
| let width = 600; | |
| let height = 400; | |
| // Dynamic configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { canvas, onResize } from 'canvas'; | |
| const ctx = canvas.getContext('2d'); | |
| let width = 300; | |
| let height = 150; | |
| // Handle canvas resizing automatically | |
| onResize((w, h) => { | |
| width = w; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { canvas, onResize } from 'canvas'; | |
| import { mobius } from '@gkucmierz/utils@3.2.0'; | |
| const ctx = canvas.getContext('2d'); | |
| // --- Configuration Constants --- | |
| const BG_COLOR = '#0f172a'; // Background color of the canvas (Slate 900) | |
| const LINE_OPACITY = 0.7; // Opacity of all plotted function lines (0.0 to 1.0) | |
| const MAX_X = 150; | |
| const MAX_Y = 0; // Maximum limit on Y axis (set to 0 or -1 for auto-scaling) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { canvas, onResize } from 'canvas'; | |
| import { mobius } from '@gkucmierz/utils@3.2.0'; | |
| const ctx = canvas.getContext('2d'); | |
| // --- Configuration Constants --- | |
| const BG_COLOR = '#0f172a'; // Background color of the canvas (Slate 900) | |
| const MAX_X = 250; | |
| const MAX_Y = 0; // Maximum limit on Y axis (set to 0 or -1 for auto-scaling) | |
| const STEP_X = 20; // Grid step size for X axis (set to 0 for auto-scaling) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { canvas, onResize } from 'canvas'; | |
| const ctx = canvas.getContext('2d'); | |
| onResize((width, height) => { | |
| // Adjust drawing buffer size to match splitter dimensions | |
| canvas.width = width; | |
| canvas.height = height; | |
| // 1. Background - elegant, dark navy (cyber-dark style) | |
| ctx.fillStyle = '#090d16'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { factorsBI, arrayHistogram } from '@gkucmierz/utils'; | |
| const generatePin = () => { | |
| return Math.trunc(Math.random() * 1e6).toString().padStart(6, '0'); | |
| } | |
| for (let i = 0; i < 10; ++i) { | |
| const pin = generatePin(); | |
| const csum = detSigDig(pin); | |
| console.log(pin, csum); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const LagDetector = (() => { | |
| let run = true; | |
| const TRESHOLD = 1e3/60 + 1; // ~60 FPS | |
| let lastTime = +new Date(); | |
| (function loop() { | |
| const time = +new Date(); | |
| const diff = time - lastTime; | |
| if (diff > TRESHOLD) { | |
| console.log(`Interface blocked for ${diff}ms`); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* -------------------------------------------------------------- | |
| Labirynt | |
| Otwarcie: górna krawędź po prawej → wejście | |
| dolna krawędź po lewej → wyjście | |
| Unikalny szlak od wejścia do wyjścia → perfekcyjny labirynt | |
| -------------------------------------------------------------- */ | |
| const labW = 38; // szerokość (liczba pól) | |
| const labH = 18; // wysokość (liczba pól) |
NewerOlder