q5 3.8.0 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/defs/q5-c2d-es.d.ts +74 -81
- package/defs/q5-c2d.d.ts +16 -1
- package/defs/q5-es.d.ts +99 -82
- package/deno.json +1 -1
- package/package.json +1 -1
- package/q5.d.ts +16 -1
- package/q5.js +65 -40
- package/q5.min.js +1 -1
package/defs/q5-es.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
|
|
3
|
-
// ⭐
|
|
3
|
+
// ⭐ núcleo
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Bienvenido al contenido de q5! 🤩
|
|
@@ -52,7 +52,7 @@ declare global {
|
|
|
52
52
|
*/
|
|
53
53
|
function log(mensaje: any): void;
|
|
54
54
|
|
|
55
|
-
// 🧑🎨
|
|
55
|
+
// 🧑🎨 formas
|
|
56
56
|
|
|
57
57
|
/** 🧑🎨
|
|
58
58
|
* Dibuja un círculo en la posición (x, y) con el diámetro especificado.
|
|
@@ -63,7 +63,7 @@ declare global {
|
|
|
63
63
|
* await crearLienzo(200, 100);
|
|
64
64
|
* círculo(0, 0, 80);
|
|
65
65
|
*/
|
|
66
|
-
function círculo(): void;
|
|
66
|
+
function círculo(x: number, y: number, diámetro: number): void;
|
|
67
67
|
|
|
68
68
|
/** 🧑🎨
|
|
69
69
|
* Dibuja una elipse.
|
|
@@ -135,7 +135,7 @@ declare global {
|
|
|
135
135
|
* trazo('lime');
|
|
136
136
|
* línea(-80, -30, 80, 30);
|
|
137
137
|
*/
|
|
138
|
-
function línea(): void;
|
|
138
|
+
function línea(x1: number, y1: number, x2: number, y2: number): void;
|
|
139
139
|
|
|
140
140
|
/** 🧑🎨
|
|
141
141
|
* Dibuja una cápsula.
|
|
@@ -157,7 +157,7 @@ declare global {
|
|
|
157
157
|
* cápsula(0, 0, ratónX, ratónY, 20);
|
|
158
158
|
* };
|
|
159
159
|
*/
|
|
160
|
-
function cápsula(): void;
|
|
160
|
+
function cápsula(x1: number, y1: number, x2: number, y2: number, r: number): void;
|
|
161
161
|
|
|
162
162
|
/** 🧑🎨
|
|
163
163
|
* Establecer a `ESQUINA` (por defecto), `CENTRO`, `RADIO`, o `ESQUINAS`.
|
|
@@ -248,7 +248,7 @@ declare global {
|
|
|
248
248
|
*/
|
|
249
249
|
const ESQUINAS: 'corners';
|
|
250
250
|
|
|
251
|
-
// 🌆
|
|
251
|
+
// 🌆 imagen
|
|
252
252
|
|
|
253
253
|
/** 🌆
|
|
254
254
|
* Carga una imagen desde una URL.
|
|
@@ -425,7 +425,7 @@ declare global {
|
|
|
425
425
|
* teñir(1, 0, 0, 0.5);
|
|
426
426
|
* imagen(logo, -100, -100, 200, 200);
|
|
427
427
|
*/
|
|
428
|
-
function teñir(): void;
|
|
428
|
+
function teñir(color: string | number): void;
|
|
429
429
|
|
|
430
430
|
/** 🌆
|
|
431
431
|
* Las imágenes dibujadas después de ejecutar esta función no serán teñidas.
|
|
@@ -531,7 +531,7 @@ declare global {
|
|
|
531
531
|
* y los datos del píxel inferior derecho están al final, yendo de
|
|
532
532
|
* izquierda a derecha y de arriba a abajo.
|
|
533
533
|
*/
|
|
534
|
-
|
|
534
|
+
var píxeles: number[];
|
|
535
535
|
|
|
536
536
|
/** 🌆
|
|
537
537
|
* Carga datos de píxeles en `píxeles` desde el lienzo o imagen.
|
|
@@ -653,9 +653,9 @@ declare global {
|
|
|
653
653
|
* @param {object} [opt] opciones
|
|
654
654
|
* @returns {Q5} un nuevo búfer de gráficos Q5
|
|
655
655
|
*/
|
|
656
|
-
function crearGráficos():
|
|
656
|
+
function crearGráficos(w: number, h: number, opt?: any): Q5;
|
|
657
657
|
|
|
658
|
-
// 📘
|
|
658
|
+
// 📘 texto
|
|
659
659
|
|
|
660
660
|
/** 📘
|
|
661
661
|
* Renderiza texto en el lienzo.
|
|
@@ -775,7 +775,7 @@ declare global {
|
|
|
775
775
|
* texto('A', -90, 90);
|
|
776
776
|
* };
|
|
777
777
|
*/
|
|
778
|
-
function tamañoTexto(): void;
|
|
778
|
+
function tamañoTexto(tamaño?: number): number | void;
|
|
779
779
|
|
|
780
780
|
/** 📘
|
|
781
781
|
* Establece u obtiene la altura de línea actual. Si no se proporciona argumento, devuelve la altura de línea actual.
|
|
@@ -820,7 +820,7 @@ declare global {
|
|
|
820
820
|
* alineaciónTexto(CENTRO, MEDIO);
|
|
821
821
|
* texto('Hello, world!', 0, 0);
|
|
822
822
|
*/
|
|
823
|
-
function alineaciónTexto(): void;
|
|
823
|
+
function alineaciónTexto(horiz: 'left' | 'center' | 'right', vert?: 'top' | 'middle' | 'bottom' | 'alphabetic'): void;
|
|
824
824
|
|
|
825
825
|
/** 📘
|
|
826
826
|
* Establece el peso del texto.
|
|
@@ -1010,7 +1010,7 @@ declare global {
|
|
|
1010
1010
|
*/
|
|
1011
1011
|
const LINEA_BASE: 'alphabetic';
|
|
1012
1012
|
|
|
1013
|
-
// 🖲
|
|
1013
|
+
// 🖲 entrada
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
1016
1016
|
* El manejo de entrada de q5 es muy básico.
|
|
@@ -1035,7 +1035,7 @@ declare global {
|
|
|
1035
1035
|
* texto(redondear(ratónX), -50, 20);
|
|
1036
1036
|
* };
|
|
1037
1037
|
*/
|
|
1038
|
-
|
|
1038
|
+
let ratónX: number;
|
|
1039
1039
|
|
|
1040
1040
|
/** 🖲
|
|
1041
1041
|
* Posición Y actual del ratón.
|
|
@@ -1045,17 +1045,17 @@ declare global {
|
|
|
1045
1045
|
* círculo(0, ratónY, 100);
|
|
1046
1046
|
* };
|
|
1047
1047
|
*/
|
|
1048
|
-
|
|
1048
|
+
let ratónY: number;
|
|
1049
1049
|
|
|
1050
1050
|
/** 🖲
|
|
1051
1051
|
* Posición X previa del ratón.
|
|
1052
1052
|
*/
|
|
1053
|
-
|
|
1053
|
+
let pRatónX: number;
|
|
1054
1054
|
|
|
1055
1055
|
/** 🖲
|
|
1056
1056
|
* Posición Y previa del ratón.
|
|
1057
1057
|
*/
|
|
1058
|
-
|
|
1058
|
+
let pRatónY: number;
|
|
1059
1059
|
|
|
1060
1060
|
/** 🖲
|
|
1061
1061
|
* El botón actual siendo presionado: 'left', 'right', 'center').
|
|
@@ -1068,7 +1068,7 @@ declare global {
|
|
|
1068
1068
|
* texto(botónRatón, -80, 20);
|
|
1069
1069
|
* };
|
|
1070
1070
|
*/
|
|
1071
|
-
|
|
1071
|
+
let botónRatón: string;
|
|
1072
1072
|
|
|
1073
1073
|
/** 🖲
|
|
1074
1074
|
* Verdadero si el ratón está actualmente presionado, falso de lo contrario.
|
|
@@ -1078,7 +1078,7 @@ declare global {
|
|
|
1078
1078
|
* else fondo(0.8);
|
|
1079
1079
|
* };
|
|
1080
1080
|
*/
|
|
1081
|
-
|
|
1081
|
+
let ratónPresionado: boolean;
|
|
1082
1082
|
|
|
1083
1083
|
/** 🖲
|
|
1084
1084
|
* Define esta función para responder a eventos de presionar el ratón.
|
|
@@ -1339,7 +1339,7 @@ declare global {
|
|
|
1339
1339
|
* return false;
|
|
1340
1340
|
* };
|
|
1341
1341
|
*/
|
|
1342
|
-
function ruedaRatón(): void;
|
|
1342
|
+
function ruedaRatón(evento: any): void;
|
|
1343
1343
|
|
|
1344
1344
|
/** 🖲
|
|
1345
1345
|
* Solicita que el puntero se bloquee al cuerpo del documento, ocultando
|
|
@@ -1670,7 +1670,7 @@ declare global {
|
|
|
1670
1670
|
niveles: number[];
|
|
1671
1671
|
}
|
|
1672
1672
|
|
|
1673
|
-
// 💅
|
|
1673
|
+
// 💅 estilos
|
|
1674
1674
|
|
|
1675
1675
|
/** 💅
|
|
1676
1676
|
* Establece el color de relleno. El defecto es blanco.
|
|
@@ -1819,7 +1819,7 @@ declare global {
|
|
|
1819
1819
|
* No disponible en q5 WebGPU.
|
|
1820
1820
|
* @param {CanvasLineCap} val estilo de terminación de línea
|
|
1821
1821
|
*/
|
|
1822
|
-
function terminaciónTrazo(): void;
|
|
1822
|
+
function terminaciónTrazo(val: CanvasLineCap): void;
|
|
1823
1823
|
|
|
1824
1824
|
/** 💅
|
|
1825
1825
|
* Establece el estilo de unión de línea a `ROUND`, `BEVEL`, o `MITER`.
|
|
@@ -1827,7 +1827,7 @@ declare global {
|
|
|
1827
1827
|
* No disponible en q5 WebGPU.
|
|
1828
1828
|
* @param {CanvasLineJoin} val estilo de unión de línea
|
|
1829
1829
|
*/
|
|
1830
|
-
function uniónTrazo(): void;
|
|
1830
|
+
function uniónTrazo(val: CanvasLineJoin): void;
|
|
1831
1831
|
|
|
1832
1832
|
/** 💅
|
|
1833
1833
|
* Establece el lienzo en modo borrar, donde las formas borrarán lo que está
|
|
@@ -1909,7 +1909,7 @@ declare global {
|
|
|
1909
1909
|
*/
|
|
1910
1910
|
function enTrazo(x: number, y: number): boolean;
|
|
1911
1911
|
|
|
1912
|
-
// 🦋
|
|
1912
|
+
// 🦋 transformaciones
|
|
1913
1913
|
|
|
1914
1914
|
/** 🦋
|
|
1915
1915
|
* Traslada el origen del contexto de dibujo.
|
|
@@ -2088,7 +2088,7 @@ declare global {
|
|
|
2088
2088
|
|
|
2089
2089
|
function recuperar(): void;
|
|
2090
2090
|
|
|
2091
|
-
// 💻
|
|
2091
|
+
// 💻 visualización
|
|
2092
2092
|
|
|
2093
2093
|
/** 💻
|
|
2094
2094
|
* Personaliza cómo se presenta tu lienzo.
|
|
@@ -2102,7 +2102,7 @@ declare global {
|
|
|
2102
2102
|
*
|
|
2103
2103
|
* círculo(0, 0, 16);
|
|
2104
2104
|
*/
|
|
2105
|
-
function modoVisualización(): void;
|
|
2105
|
+
function modoVisualización(modo: string, calidadRender: string, escala: string | number): void;
|
|
2106
2106
|
|
|
2107
2107
|
/** 💻
|
|
2108
2108
|
* Una configuración de `modoVisualización`.
|
|
@@ -2345,7 +2345,7 @@ declare global {
|
|
|
2345
2345
|
* densidadPíxeles(1);
|
|
2346
2346
|
* círculo(0, 0, 80);
|
|
2347
2347
|
*/
|
|
2348
|
-
function densidadPíxeles():
|
|
2348
|
+
function densidadPíxeles(v: number): number;
|
|
2349
2349
|
|
|
2350
2350
|
/** 💻
|
|
2351
2351
|
* Devuelve la densidad de visualización actual.
|
|
@@ -2358,7 +2358,7 @@ declare global {
|
|
|
2358
2358
|
* tamañoTexto(64);
|
|
2359
2359
|
* texto(densidadVisualización(), -90, 6);
|
|
2360
2360
|
*/
|
|
2361
|
-
function densidadVisualización():
|
|
2361
|
+
function densidadVisualización(): number;
|
|
2362
2362
|
|
|
2363
2363
|
/** 💻
|
|
2364
2364
|
* El tiempo pasado desde que se dibujó el último fotograma.
|
|
@@ -2395,7 +2395,7 @@ declare global {
|
|
|
2395
2395
|
*/
|
|
2396
2396
|
var contextoDibujo: CanvasRenderingContext2D;
|
|
2397
2397
|
|
|
2398
|
-
// 🧮
|
|
2398
|
+
// 🧮 matemáticas
|
|
2399
2399
|
|
|
2400
2400
|
/** 🧮
|
|
2401
2401
|
* Genera un valor aleatorio.
|
|
@@ -2515,7 +2515,7 @@ declare global {
|
|
|
2515
2515
|
* Establece el modo para interpretar y dibujar ángulos. Puede ser 'degrees' (grados) o 'radians' (radianes).
|
|
2516
2516
|
* @param {'degrees' | 'radians'} modo modo a establecer para la interpretación de ángulos
|
|
2517
2517
|
*/
|
|
2518
|
-
function modoÁngulo(): void;
|
|
2518
|
+
function modoÁngulo(modo: 'degrees' | 'radians'): void;
|
|
2519
2519
|
|
|
2520
2520
|
/** 🧮
|
|
2521
2521
|
* Convierte grados a radianes.
|
|
@@ -2547,7 +2547,7 @@ declare global {
|
|
|
2547
2547
|
* @param {number} alto límite superior
|
|
2548
2548
|
* @returns {number} valor restringido
|
|
2549
2549
|
*/
|
|
2550
|
-
function constreñir():
|
|
2550
|
+
function constreñir(n: number, bajo: number, alto: number): number;
|
|
2551
2551
|
|
|
2552
2552
|
/** 🧮
|
|
2553
2553
|
* Normaliza un número de otro rango en un valor entre 0 y 1.
|
|
@@ -2749,7 +2749,7 @@ declare global {
|
|
|
2749
2749
|
*/
|
|
2750
2750
|
const CUARTO_PI: number;
|
|
2751
2751
|
|
|
2752
|
-
// 🔊
|
|
2752
|
+
// 🔊 sonido
|
|
2753
2753
|
|
|
2754
2754
|
/**
|
|
2755
2755
|
* q5 incluye reproducción de sonido de baja latencia y capacidades básicas de mezcla
|
|
@@ -2958,7 +2958,7 @@ declare global {
|
|
|
2958
2958
|
* fondo(aleatorio(0.4, 1));
|
|
2959
2959
|
* });
|
|
2960
2960
|
*/
|
|
2961
|
-
function crearBotón():
|
|
2961
|
+
function crearBotón(contenido?: string): HTMLButtonElement;
|
|
2962
2962
|
|
|
2963
2963
|
/** 📑
|
|
2964
2964
|
* Crea un elemento de casilla de verificación (checkbox).
|
|
@@ -3067,7 +3067,7 @@ declare global {
|
|
|
3067
3067
|
* if (radio.value == '2') círculo(0, 0, 80);
|
|
3068
3068
|
* };
|
|
3069
3069
|
*/
|
|
3070
|
-
function crearOpciónes():
|
|
3070
|
+
function crearOpciónes(nombreGrupo?: string): HTMLDivElement;
|
|
3071
3071
|
|
|
3072
3072
|
/** 📑
|
|
3073
3073
|
* Crea un elemento de selección (select).
|
|
@@ -3093,7 +3093,7 @@ declare global {
|
|
|
3093
3093
|
* fondo(sel.value);
|
|
3094
3094
|
* });
|
|
3095
3095
|
*/
|
|
3096
|
-
function crearSelección():
|
|
3096
|
+
function crearSelección(placeholder?: string): HTMLSelectElement;
|
|
3097
3097
|
|
|
3098
3098
|
/** 📑
|
|
3099
3099
|
* Crea un elemento deslizador (slider).
|
|
@@ -3208,7 +3208,7 @@ declare global {
|
|
|
3208
3208
|
*/
|
|
3209
3209
|
function encontrarElementos(selector: string): HTMLElement[];
|
|
3210
3210
|
|
|
3211
|
-
// 🎞
|
|
3211
|
+
// 🎞 grabación
|
|
3212
3212
|
|
|
3213
3213
|
/** 🎞
|
|
3214
3214
|
* Crea una grabadora. ¡Simplemente presiona grabar para empezar a grabar!
|
|
@@ -3270,14 +3270,14 @@ declare global {
|
|
|
3270
3270
|
* else guardarGrabación('squares');
|
|
3271
3271
|
* };
|
|
3272
3272
|
*/
|
|
3273
|
-
function guardarGrabación(): void;
|
|
3273
|
+
function guardarGrabación(nombreArchivo: string): void;
|
|
3274
3274
|
|
|
3275
3275
|
/** 🎞
|
|
3276
3276
|
* Verdadero si el lienzo está siendo grabado actualmente.
|
|
3277
3277
|
*/
|
|
3278
3278
|
var grabando: boolean;
|
|
3279
3279
|
|
|
3280
|
-
// 🛠
|
|
3280
|
+
// 🛠 utilidades
|
|
3281
3281
|
|
|
3282
3282
|
/** 🛠
|
|
3283
3283
|
* Carga un archivo o múltiples archivos.
|
|
@@ -3467,13 +3467,13 @@ declare global {
|
|
|
3467
3467
|
* Devuelve el año actual.
|
|
3468
3468
|
* @returns {number} año actual
|
|
3469
3469
|
*/
|
|
3470
|
-
function año():
|
|
3470
|
+
function año(): number;
|
|
3471
3471
|
|
|
3472
3472
|
/** 🛠
|
|
3473
3473
|
* Devuelve el día actual del mes.
|
|
3474
3474
|
* @returns {number} día actual
|
|
3475
3475
|
*/
|
|
3476
|
-
function día():
|
|
3476
|
+
function día(): number;
|
|
3477
3477
|
|
|
3478
3478
|
/** 🛠
|
|
3479
3479
|
* Devuelve la hora actual.
|
|
@@ -3736,7 +3736,7 @@ declare global {
|
|
|
3736
3736
|
|
|
3737
3737
|
}
|
|
3738
3738
|
|
|
3739
|
-
// 🖌
|
|
3739
|
+
// 🖌 modelado
|
|
3740
3740
|
|
|
3741
3741
|
/** 🖌
|
|
3742
3742
|
* Dibuja un arco, que es una sección de una elipse.
|
|
@@ -3814,7 +3814,7 @@ declare global {
|
|
|
3814
3814
|
* @param {number} x coordenada-x
|
|
3815
3815
|
* @param {number} y coordenada-y
|
|
3816
3816
|
*/
|
|
3817
|
-
function vértice(): void;
|
|
3817
|
+
function vértice(x: number, y: number): void;
|
|
3818
3818
|
|
|
3819
3819
|
/** 🖌
|
|
3820
3820
|
* Especifica un vértice Bezier en una forma.
|
|
@@ -3825,7 +3825,7 @@ declare global {
|
|
|
3825
3825
|
* @param {number} x coordenada-x del punto de anclaje
|
|
3826
3826
|
* @param {number} y coordenada-y del punto de anclaje
|
|
3827
3827
|
*/
|
|
3828
|
-
function vérticeBezier(): void;
|
|
3828
|
+
function vérticeBezier(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;
|
|
3829
3829
|
|
|
3830
3830
|
/** 🖌
|
|
3831
3831
|
* Especifica un vértice Bezier cuadrático en una forma.
|
|
@@ -3834,7 +3834,7 @@ declare global {
|
|
|
3834
3834
|
* @param {number} x coordenada-x del punto de anclaje
|
|
3835
3835
|
* @param {number} y coordenada-y del punto de anclaje
|
|
3836
3836
|
*/
|
|
3837
|
-
function vérticeCuadrático(): void;
|
|
3837
|
+
function vérticeCuadrático(cp1x: number, cp1y: number, x: number, y: number): void;
|
|
3838
3838
|
|
|
3839
3839
|
/** 🖌
|
|
3840
3840
|
* Dibuja una curva Bezier.
|
|
@@ -3858,7 +3858,7 @@ declare global {
|
|
|
3858
3858
|
* @param {number} x3 coordenada-x del tercer vértice
|
|
3859
3859
|
* @param {number} y3 coordenada-y del tercer vértice
|
|
3860
3860
|
*/
|
|
3861
|
-
function triángulo(): void;
|
|
3861
|
+
function triángulo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void;
|
|
3862
3862
|
|
|
3863
3863
|
/** 🖌
|
|
3864
3864
|
* Dibuja un cuadrilátero.
|
|
@@ -3873,7 +3873,7 @@ declare global {
|
|
|
3873
3873
|
*/
|
|
3874
3874
|
function quad(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number): void;
|
|
3875
3875
|
|
|
3876
|
-
// ⚡
|
|
3876
|
+
// ⚡ sombreadores
|
|
3877
3877
|
|
|
3878
3878
|
/**
|
|
3879
3879
|
* ¡Shaders personalizados escritos en WGSL (WebGPU Shading Language) pueden ser
|
|
@@ -4147,7 +4147,7 @@ declare global {
|
|
|
4147
4147
|
*/
|
|
4148
4148
|
function crearShaderTexto(codigo: string): GPUShaderModule;
|
|
4149
4149
|
|
|
4150
|
-
// ⚙
|
|
4150
|
+
// ⚙ avanzado
|
|
4151
4151
|
|
|
4152
4152
|
/** ⚙
|
|
4153
4153
|
* Alias para `Q5`.
|
|
@@ -4163,27 +4163,48 @@ declare global {
|
|
|
4163
4163
|
*/
|
|
4164
4164
|
constructor(scope?: string | Function, parent?: HTMLElement);
|
|
4165
4165
|
|
|
4166
|
+
/** ⚙
|
|
4167
|
+
* La versión menor actual de q5.
|
|
4168
|
+
* @returns {string} la versión de q5
|
|
4169
|
+
* @example
|
|
4170
|
+
* await crearLienzo(200);
|
|
4171
|
+
* fondo(0.8);
|
|
4172
|
+
* tamañoTexto(64);
|
|
4173
|
+
* alineaciónTexto(CENTRO, CENTRO);
|
|
4174
|
+
* texto('v' + Q5.version, 0, 0);
|
|
4175
|
+
*/
|
|
4176
|
+
version(): void;
|
|
4177
|
+
|
|
4178
|
+
/** ⚙
|
|
4179
|
+
* Establece un código de idioma distinto de 'en' (inglés) para usar q5 en otro idioma.
|
|
4180
|
+
*
|
|
4181
|
+
* Idiomas actualmente soportados:
|
|
4182
|
+
*
|
|
4183
|
+
* - 'es' (Español)
|
|
4184
|
+
*/
|
|
4185
|
+
static lang: string;
|
|
4186
|
+
|
|
4166
4187
|
/** ⚙
|
|
4167
4188
|
* Desactiva los mensajes de error amigables de q5.
|
|
4168
4189
|
*/
|
|
4169
|
-
|
|
4190
|
+
static deshabilitarErroresAmigables: boolean;
|
|
4170
4191
|
|
|
4171
4192
|
/** ⚙
|
|
4172
4193
|
* Establecer en verdadero para mantener el bucle de dibujo después de un error.
|
|
4173
4194
|
*/
|
|
4174
|
-
|
|
4195
|
+
static toleranteErrores: boolean;
|
|
4175
4196
|
|
|
4176
4197
|
/** ⚙
|
|
4177
4198
|
* Verdadero si el dispositivo soporta HDR (el espacio de color display-p3).
|
|
4178
4199
|
*/
|
|
4179
|
-
|
|
4200
|
+
static soportaHDR: boolean;
|
|
4180
4201
|
|
|
4181
4202
|
/** ⚙
|
|
4182
4203
|
* Establece los atributos de contexto de lienzo predeterminados utilizados para
|
|
4183
4204
|
* lienzos recién creados y gráficos internos. Estas opciones son sobrescritas por
|
|
4184
4205
|
* cualquier opción por lienzo que pases a `crearLienzo`.
|
|
4185
4206
|
*/
|
|
4186
|
-
|
|
4207
|
+
static opcionesLienzo: object;
|
|
4187
4208
|
|
|
4188
4209
|
/** ⚙
|
|
4189
4210
|
* Un límite de asignación de memoria WebGPU.
|
|
@@ -4191,7 +4212,7 @@ declare global {
|
|
|
4191
4212
|
* El número máximo de matrices de transformación
|
|
4192
4213
|
* que se pueden usar en una sola llamada de dibujo.
|
|
4193
4214
|
*/
|
|
4194
|
-
|
|
4215
|
+
static MAX_TRANSFORMACIONES: number;
|
|
4195
4216
|
|
|
4196
4217
|
/** ⚙
|
|
4197
4218
|
* Un límite de asignación de memoria WebGPU.
|
|
@@ -4209,7 +4230,7 @@ declare global {
|
|
|
4209
4230
|
* (llamadas a `elipse`, `círculo`, y `arco`)
|
|
4210
4231
|
* que se pueden dibujar en una sola llamada de dibujo.
|
|
4211
4232
|
*/
|
|
4212
|
-
|
|
4233
|
+
static MAX_ELIPSES: number;
|
|
4213
4234
|
|
|
4214
4235
|
/** ⚙
|
|
4215
4236
|
* Un límite de asignación de memoria WebGPU.
|
|
@@ -4217,7 +4238,7 @@ declare global {
|
|
|
4217
4238
|
* El número máximo de caracteres de texto
|
|
4218
4239
|
* que se pueden dibujar en una sola llamada de dibujo.
|
|
4219
4240
|
*/
|
|
4220
|
-
|
|
4241
|
+
static MAX_CARACTERES: number;
|
|
4221
4242
|
|
|
4222
4243
|
/** ⚙
|
|
4223
4244
|
* Un límite de asignación de memoria WebGPU.
|
|
@@ -4225,7 +4246,7 @@ declare global {
|
|
|
4225
4246
|
* El número máximo de llamadas separadas a `texto`
|
|
4226
4247
|
* que se pueden dibujar en una sola llamada de dibujo.
|
|
4227
4248
|
*/
|
|
4228
|
-
|
|
4249
|
+
static MAX_TEXTOS: number;
|
|
4229
4250
|
|
|
4230
4251
|
/** ⚙
|
|
4231
4252
|
* Crea una nueva instancia de Q5 que usa el [renderizador WebGPU de q5](https://github.com/q5js/q5.js/wiki/q5-WebGPU-renderer).
|
|
@@ -4245,14 +4266,32 @@ declare global {
|
|
|
4245
4266
|
* funciones que se ejecutan en fases específicas del ciclo de vida de q5.
|
|
4246
4267
|
*
|
|
4247
4268
|
* Dentro de la función, `this` se refiere a la instancia de Q5.
|
|
4248
|
-
* @param {string} lifecycle init, presetup, postsetup, predraw, postdraw, o remove
|
|
4269
|
+
* @param {string} lifecycle 'init', 'presetup', 'postsetup', 'predraw', 'postdraw', o 'remove'
|
|
4249
4270
|
* @param {Function} fn La función que se ejecutará en la fase del ciclo de vida especificada.
|
|
4271
|
+
* @example
|
|
4272
|
+
* Q5.addHook('predraw', function () {
|
|
4273
|
+
* this.fondo('cyan');
|
|
4274
|
+
* });
|
|
4275
|
+
*
|
|
4276
|
+
* q5.dibujar = function () {
|
|
4277
|
+
* círculo(ratónX, ratónY, 80);
|
|
4278
|
+
* };
|
|
4250
4279
|
*/
|
|
4251
4280
|
addHook(): void;
|
|
4252
4281
|
|
|
4253
4282
|
/** ⚙
|
|
4254
4283
|
* Forma compatible con p5.js v2 de registrar un addon con q5.
|
|
4255
4284
|
* @param {Function} addon Una función que recibe `Q5`, `Q5.prototype`, y un objeto `lifecycles`.
|
|
4285
|
+
* @example
|
|
4286
|
+
* // addon.js
|
|
4287
|
+
* Q5.registerAddon((Q5, proto, lifecycles) => {
|
|
4288
|
+
* lifecycles.predraw = function () {
|
|
4289
|
+
* this.fondo('pink');
|
|
4290
|
+
* };
|
|
4291
|
+
* });
|
|
4292
|
+
*
|
|
4293
|
+
* // sketch.js
|
|
4294
|
+
* await crearLienzo(200);
|
|
4256
4295
|
*/
|
|
4257
4296
|
registerAddon(): void;
|
|
4258
4297
|
|
|
@@ -4264,12 +4303,12 @@ declare global {
|
|
|
4264
4303
|
* - la instancia de q5
|
|
4265
4304
|
* - un proxy para editar la instancia de q5 y las propiedades correspondientes del ámbito global
|
|
4266
4305
|
*/
|
|
4267
|
-
|
|
4306
|
+
static modulos: object;
|
|
4268
4307
|
|
|
4269
4308
|
/** ⚙
|
|
4270
4309
|
* La función de dibujo de q5 se ejecuta 60 veces por segundo por defecto.
|
|
4271
4310
|
*/
|
|
4272
|
-
|
|
4311
|
+
dibujar(): void;
|
|
4273
4312
|
|
|
4274
4313
|
/** ⚙
|
|
4275
4314
|
* Se ejecuta después de cada llamada a la función `dibujar` y procesos de addons de q5 post-dibujo, si los hay.
|
|
@@ -4279,37 +4318,15 @@ declare global {
|
|
|
4279
4318
|
* addons como p5play que dibujan automáticamente al lienzo después de que
|
|
4280
4319
|
* la función `dibujar` se ejecuta.
|
|
4281
4320
|
*/
|
|
4282
|
-
|
|
4283
|
-
static
|
|
4284
|
-
|
|
4285
|
-
static toleranteErrores: boolean;
|
|
4286
|
-
|
|
4287
|
-
static soportaHDR: boolean;
|
|
4288
|
-
|
|
4289
|
-
static opcionesLienzo: object;
|
|
4290
|
-
|
|
4291
|
-
static MAX_ELIPSES: number;
|
|
4292
|
-
|
|
4293
|
-
static MAX_TRANSFORMACIONES: number;
|
|
4294
|
-
|
|
4295
|
-
static MAX_CARACTERES: number;
|
|
4296
|
-
|
|
4297
|
-
static MAX_TEXTOS: number;
|
|
4321
|
+
postProcesar(): void;
|
|
4322
|
+
static versión: string;
|
|
4298
4323
|
|
|
4299
4324
|
static agregarHook(cicloVida: string, fn: Function): void;
|
|
4300
4325
|
|
|
4301
4326
|
static registrarAddon(addon: Function): void;
|
|
4302
4327
|
|
|
4303
|
-
static modulos: object;
|
|
4304
|
-
|
|
4305
|
-
dibujar(): void;
|
|
4306
|
-
|
|
4307
|
-
postProcesar(): void;
|
|
4308
|
-
|
|
4309
4328
|
actualizar(): void; //-
|
|
4310
4329
|
|
|
4311
|
-
dibujarFotograma(): void; //-
|
|
4312
|
-
|
|
4313
4330
|
static Imagen: {
|
|
4314
4331
|
new (w: number, h: number, opt?: any): Q5.Imagen;
|
|
4315
4332
|
};
|
package/deno.json
CHANGED
package/package.json
CHANGED
package/q5.d.ts
CHANGED
|
@@ -3828,6 +3828,21 @@ declare global {
|
|
|
3828
3828
|
*/
|
|
3829
3829
|
constructor(scope?: string | Function, parent?: HTMLElement);
|
|
3830
3830
|
|
|
3831
|
+
/** ⚙
|
|
3832
|
+
* The current minor version of q5.
|
|
3833
|
+
* @returns {string} the q5 version
|
|
3834
|
+
*/
|
|
3835
|
+
static version: string;
|
|
3836
|
+
|
|
3837
|
+
/** ⚙
|
|
3838
|
+
* Set to a language code other than 'en' (English) to use q5 in an additional language.
|
|
3839
|
+
*
|
|
3840
|
+
* Currently supported languages:
|
|
3841
|
+
*
|
|
3842
|
+
* - 'es' (Spanish)
|
|
3843
|
+
*/
|
|
3844
|
+
static lang: string;
|
|
3845
|
+
|
|
3831
3846
|
/** ⚙
|
|
3832
3847
|
* Turn off q5's friendly error messages.
|
|
3833
3848
|
*/
|
|
@@ -3902,7 +3917,7 @@ declare global {
|
|
|
3902
3917
|
* functions to be run at specific phases in the q5 lifecycle.
|
|
3903
3918
|
*
|
|
3904
3919
|
* Inside the function, `this` refers to the Q5 instance.
|
|
3905
|
-
* @param {string} lifecycle init, presetup, postsetup, predraw, postdraw, or remove
|
|
3920
|
+
* @param {string} lifecycle 'init', 'presetup', 'postsetup', 'predraw', 'postdraw', or 'remove'
|
|
3906
3921
|
* @param {Function} fn The function to be run at the specified lifecycle phase.
|
|
3907
3922
|
*/
|
|
3908
3923
|
static addHook(lifecycle: string, fn: Function): void;
|