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 canvas = document.getElementById('canvas'); | |
const ctx = canvas.getContext('2d'); | |
function drawPixel(x1, y1, x2, y2, color) { | |
ctx.beginPath() | |
ctx.moveTo(x1, y1) | |
ctx.lineTo(x2, y2) | |
ctx.strokeStyle = color; | |
ctx.stroke(); | |
ctx.closePath() | |
} |
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
var canvas = document.getElementById('canvas'); | |
var ctx = canvas.getContext('2d'); | |
function drawCircle(x1, y1, x2, y2, color) { | |
ctx.beginPath() | |
ctx.arc(100, 100, 50, 0, 2 * Math.PI); | |
ctx.lineWidth = 2; | |
ctx.strokeStyle = color; | |
ctx.stroke(); |
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
<svg width="200" height="200"> | |
<circle r="50" cx="100" cy="100" stroke="red" stroke-width="2" /> | |
</svg> |
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
// code taken from | |
// https://stackoverflow.com/a/50625904 | |
var canvas = document.getElementById('canvas'); | |
var ctx = canvas.getContext('2d'); | |
function BMFastPixelArtLine(ctx, x1, y1, x2, y2) { | |
x1 = Math.round(x1); | |
y1 = Math.round(y1); | |
x2 = Math.round(x2); | |
y2 = Math.round(y2); |
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
var canvas = document.getElementById('canvas'); | |
var ctx = canvas.getContext('2d'); | |
function drawLine(x1, y1, x2, y2, color) { | |
ctx.beginPath() | |
ctx.moveTo(x1, y1) | |
ctx.lineTo(x2, y2) | |
ctx.lineWidth = 2; | |
ctx.strokeStyle = color; | |
ctx.stroke(); |
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
<svg width="200" height="200"> | |
<line x1="50" y1="50" x2="150" y2="150" stroke="red" stroke-width="2" /> | |
</svg> |
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 { resolve } from 'node:path' | |
import libAssetsPlugin from '@laynezh/vite-plugin-lib-assets' | |
import { terser } from 'rollup-plugin-terser'; | |
import { defineConfig } from 'vite' | |
// https://vitejs.dev/config/ | |
export default defineConfig(() => ({ | |
plugins: [ |
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
{ | |
"name": "design-system-react", | |
"version": "1.0.5", | |
"description": "", | |
"main": "dist/index.js", | |
"module": "dist/index.modern.js", | |
"source": "src/index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"build": "", |
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
{ | |
"name": "design-system-react", | |
"version": "1.0.0", | |
"description": "", | |
"main": "dist/index.js", | |
"module": "dist/index.modern.js", | |
"source": "src/index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"build": "microbundle --jsx React.createElement --jsxFragment React.Fragment --no-compress", |
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
// Run using quokka - vscode | |
// Arrays | |
var init = [1,2,3,4,5] | |
var [a,b,c] = init | |
// for a, b, c map one to one and skip rest | |
a | |
b | |
c |
NewerOlder