Deriving a new Array from an existing Array:
['■','●','▲'].slice(1, 3) ⟼ ['●','▲']
['■','●','■'].filter(x => x==='■') ⟼ ['■','■']
['▲','●'].map(x => x+x) ⟼ ['▲▲','●●']
['▲','●'].flatMap(x => [x,x]) ⟼ ['▲','▲','●','●']| const sketcher = require('canvas-sketch-tool'); | |
| const settings = { | |
| // Pixel [width,height] of our artwork | |
| dimensions: [ 1280, 1280 ], | |
| // Export at a higher resolution than what we see | |
| // in the browser | |
| exportPixelRatio: 2 | |
| }; |
| const canvasSketch = require('canvas-sketch'); // not yet released tool | |
| const Random = require('./util/random'); | |
| const { lerp } = require('./util/math'); | |
| // We can force a random seed or a specific string/number | |
| Random.setSeed(Random.getRandomSeed()); | |
| const settings = { | |
| pixelsPerInch: 300, | |
| // When exporting, use the seed as the suffix |
| const canvasSketch = require('canvas-sketch'); | |
| const { lerp } = require('./util/math'); | |
| const settings = { | |
| animate: true, | |
| duration: 3, | |
| dimensions: [ 640, 640 ], | |
| scaleToView: true, | |
| playbackRate: 'throttle', | |
| fps: 24 |
| from google import genai | |
| from google.genai import types | |
| from PIL import Image | |
| from io import BytesIO | |
| import os | |
| import subprocess | |
| import tempfile | |
| from global_config import global_config | |
| from loguru import logger as log |
| """ | |
| NOTE: make sure to install: | |
| pip install Pillow google-genai loguru | |
| """ | |
| from google import genai | |
| from google.genai import types | |
| from PIL import Image | |
| from io import BytesIO | |
| import os |