@remotion/transitions 4.0.521 → 4.0.523
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/blur-slide.js +2 -0
- package/dist/esm/blur-slide.mjs +527 -0
- package/dist/esm/index.mjs +305 -38
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/presentations/blur-slide.d.ts +18 -0
- package/dist/presentations/blur-slide.js +282 -0
- package/package.json +17 -8
package/dist/esm/index.mjs
CHANGED
|
@@ -334,9 +334,275 @@ var uploadElementImage = (gl, elementImage) => {
|
|
|
334
334
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, elementImage);
|
|
335
335
|
};
|
|
336
336
|
|
|
337
|
+
// src/presentations/blur-slide.tsx
|
|
338
|
+
var DEFAULT_DIRECTION = "from-left";
|
|
339
|
+
var DEFAULT_BLUR = 0.5;
|
|
340
|
+
var VALID_DIRECTIONS = [
|
|
341
|
+
"from-left",
|
|
342
|
+
"from-right",
|
|
343
|
+
"from-top",
|
|
344
|
+
"from-bottom"
|
|
345
|
+
];
|
|
346
|
+
var VERTEX_SHADER = `#version 300 es
|
|
347
|
+
in vec2 a_pos;
|
|
348
|
+
out vec2 v_uv;
|
|
349
|
+
void main() {
|
|
350
|
+
v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
|
|
351
|
+
gl_Position = vec4(a_pos, 0.0, 1.0);
|
|
352
|
+
}`;
|
|
353
|
+
var SAMPLES = 32;
|
|
354
|
+
var SLIDE_FRAGMENT_SHADER = `#version 300 es
|
|
355
|
+
precision highp float;
|
|
356
|
+
|
|
357
|
+
uniform sampler2D u_prev;
|
|
358
|
+
uniform sampler2D u_next;
|
|
359
|
+
uniform float u_progress;
|
|
360
|
+
uniform vec2 u_direction;
|
|
361
|
+
uniform float u_blur_length;
|
|
362
|
+
|
|
363
|
+
in vec2 v_uv;
|
|
364
|
+
out vec4 outColor;
|
|
365
|
+
|
|
366
|
+
const int SAMPLES = ${SAMPLES};
|
|
367
|
+
|
|
368
|
+
void main() {
|
|
369
|
+
// Both scenes travel together; the exiting scene wraps around the edges
|
|
370
|
+
// while the entering scene takes over through a crossfade in the middle.
|
|
371
|
+
vec2 slidUv = v_uv - u_direction * u_progress;
|
|
372
|
+
float mixFactor = smoothstep(0.3, 0.7, u_progress);
|
|
373
|
+
|
|
374
|
+
vec4 color = vec4(0.0);
|
|
375
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
376
|
+
float t = (float(i) / float(SAMPLES - 1) - 0.5) * u_blur_length;
|
|
377
|
+
vec2 uv = slidUv + u_direction * t;
|
|
378
|
+
color += mix(texture(u_prev, uv), texture(u_next, uv), mixFactor);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
outColor = color / float(SAMPLES);
|
|
382
|
+
}`;
|
|
383
|
+
var BLUR_FRAGMENT_SHADER = `#version 300 es
|
|
384
|
+
precision highp float;
|
|
385
|
+
|
|
386
|
+
uniform sampler2D u_source;
|
|
387
|
+
uniform vec2 u_direction;
|
|
388
|
+
uniform float u_blur_length;
|
|
389
|
+
|
|
390
|
+
in vec2 v_uv;
|
|
391
|
+
out vec4 outColor;
|
|
392
|
+
|
|
393
|
+
const int SAMPLES = ${SAMPLES};
|
|
394
|
+
|
|
395
|
+
void main() {
|
|
396
|
+
vec4 color = vec4(0.0);
|
|
397
|
+
for (int i = 0; i < SAMPLES; i++) {
|
|
398
|
+
float t = ((float(i) + 0.5) / float(SAMPLES) - 0.5) * u_blur_length;
|
|
399
|
+
vec2 uv = v_uv + u_direction * t;
|
|
400
|
+
// The framebuffer texture is stored bottom-up, so flip Y when sampling it.
|
|
401
|
+
color += texture(u_source, vec2(uv.x, 1.0 - uv.y));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
outColor = color / float(SAMPLES);
|
|
405
|
+
}`;
|
|
406
|
+
var compileShader = (gl, source, type) => {
|
|
407
|
+
const shader = gl.createShader(type);
|
|
408
|
+
if (!shader) {
|
|
409
|
+
throw new Error("Failed to create shader");
|
|
410
|
+
}
|
|
411
|
+
gl.shaderSource(shader, source);
|
|
412
|
+
gl.compileShader(shader);
|
|
413
|
+
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
414
|
+
const log = gl.getShaderInfoLog(shader);
|
|
415
|
+
gl.deleteShader(shader);
|
|
416
|
+
throw new Error(`Failed to compile shader: ${log}`);
|
|
417
|
+
}
|
|
418
|
+
return shader;
|
|
419
|
+
};
|
|
420
|
+
var createProgram = (gl, fragmentShader) => {
|
|
421
|
+
const program = gl.createProgram();
|
|
422
|
+
if (!program) {
|
|
423
|
+
throw new Error("Failed to create WebGL program");
|
|
424
|
+
}
|
|
425
|
+
const vs = compileShader(gl, VERTEX_SHADER, gl.VERTEX_SHADER);
|
|
426
|
+
const fs = compileShader(gl, fragmentShader, gl.FRAGMENT_SHADER);
|
|
427
|
+
gl.attachShader(program, vs);
|
|
428
|
+
gl.attachShader(program, fs);
|
|
429
|
+
gl.linkProgram(program);
|
|
430
|
+
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
|
431
|
+
const log = gl.getProgramInfoLog(program);
|
|
432
|
+
gl.deleteProgram(program);
|
|
433
|
+
throw new Error(`Failed to link program: ${log}`);
|
|
434
|
+
}
|
|
435
|
+
return program;
|
|
436
|
+
};
|
|
437
|
+
var createTexture = (gl) => {
|
|
438
|
+
const tex = gl.createTexture();
|
|
439
|
+
if (!tex) {
|
|
440
|
+
throw new Error("Failed to create texture");
|
|
441
|
+
}
|
|
442
|
+
gl.bindTexture(gl.TEXTURE_2D, tex);
|
|
443
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT);
|
|
444
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT);
|
|
445
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
446
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
447
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 0]));
|
|
448
|
+
return tex;
|
|
449
|
+
};
|
|
450
|
+
var getDirectionVector = (direction) => {
|
|
451
|
+
switch (direction) {
|
|
452
|
+
case "from-left":
|
|
453
|
+
return [1, 0];
|
|
454
|
+
case "from-right":
|
|
455
|
+
return [-1, 0];
|
|
456
|
+
case "from-top":
|
|
457
|
+
return [0, 1];
|
|
458
|
+
case "from-bottom":
|
|
459
|
+
return [0, -1];
|
|
460
|
+
default:
|
|
461
|
+
throw new Error(`Invalid direction: ${direction}`);
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
var validateProps = (props) => {
|
|
465
|
+
const direction = props.direction ?? DEFAULT_DIRECTION;
|
|
466
|
+
const blur = props.blur ?? DEFAULT_BLUR;
|
|
467
|
+
if (!VALID_DIRECTIONS.includes(direction)) {
|
|
468
|
+
throw new TypeError(`direction passed to blurSlide() must be one of ${VALID_DIRECTIONS.map((d) => `"${d}"`).join(", ")}, received ${JSON.stringify(direction)}`);
|
|
469
|
+
}
|
|
470
|
+
if (typeof blur !== "number" || !Number.isFinite(blur)) {
|
|
471
|
+
throw new TypeError(`blur passed to blurSlide() must be a finite number, received ${blur}`);
|
|
472
|
+
}
|
|
473
|
+
if (blur < 0) {
|
|
474
|
+
throw new TypeError(`blur passed to blurSlide() must be greater than or equal to 0, received ${blur}`);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
var blurSlideShader = (canvas) => {
|
|
478
|
+
const gl = canvas.getContext("webgl2", { premultipliedAlpha: true });
|
|
479
|
+
if (!gl) {
|
|
480
|
+
throw new Error("Failed to create WebGL2 context");
|
|
481
|
+
}
|
|
482
|
+
const slideProgram = createProgram(gl, SLIDE_FRAGMENT_SHADER);
|
|
483
|
+
const blurProgram = createProgram(gl, BLUR_FRAGMENT_SHADER);
|
|
484
|
+
const prevTex = createTexture(gl);
|
|
485
|
+
const nextTex = createTexture(gl);
|
|
486
|
+
const intermediateTex = createTexture(gl);
|
|
487
|
+
const framebuffer = gl.createFramebuffer();
|
|
488
|
+
if (!framebuffer) {
|
|
489
|
+
throw new Error("Failed to create framebuffer");
|
|
490
|
+
}
|
|
491
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
492
|
+
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, intermediateTex, 0);
|
|
493
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
494
|
+
let intermediateWidth = 1;
|
|
495
|
+
let intermediateHeight = 1;
|
|
496
|
+
const vao = gl.createVertexArray();
|
|
497
|
+
gl.bindVertexArray(vao);
|
|
498
|
+
const buffer = gl.createBuffer();
|
|
499
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
500
|
+
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);
|
|
501
|
+
const aPos = gl.getAttribLocation(slideProgram, "a_pos");
|
|
502
|
+
gl.enableVertexAttribArray(aPos);
|
|
503
|
+
gl.vertexAttribPointer(aPos, 2, gl.FLOAT, false, 0, 0);
|
|
504
|
+
const uPrev = gl.getUniformLocation(slideProgram, "u_prev");
|
|
505
|
+
const uNext = gl.getUniformLocation(slideProgram, "u_next");
|
|
506
|
+
const uProgress = gl.getUniformLocation(slideProgram, "u_progress");
|
|
507
|
+
const uSlideDirection = gl.getUniformLocation(slideProgram, "u_direction");
|
|
508
|
+
const uSlideBlurLength = gl.getUniformLocation(slideProgram, "u_blur_length");
|
|
509
|
+
const uSource = gl.getUniformLocation(blurProgram, "u_source");
|
|
510
|
+
const uBlurDirection = gl.getUniformLocation(blurProgram, "u_direction");
|
|
511
|
+
const uBlurBlurLength = gl.getUniformLocation(blurProgram, "u_blur_length");
|
|
512
|
+
const cleanup = () => {
|
|
513
|
+
gl.deleteProgram(slideProgram);
|
|
514
|
+
gl.deleteProgram(blurProgram);
|
|
515
|
+
gl.deleteTexture(prevTex);
|
|
516
|
+
gl.deleteTexture(nextTex);
|
|
517
|
+
gl.deleteTexture(intermediateTex);
|
|
518
|
+
gl.deleteFramebuffer(framebuffer);
|
|
519
|
+
gl.deleteBuffer(buffer);
|
|
520
|
+
gl.deleteVertexArray(vao);
|
|
521
|
+
};
|
|
522
|
+
const clear = () => {
|
|
523
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
524
|
+
gl.clearColor(0, 0, 0, 0);
|
|
525
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
526
|
+
};
|
|
527
|
+
const draw = ({
|
|
528
|
+
prevImage,
|
|
529
|
+
nextImage,
|
|
530
|
+
width,
|
|
531
|
+
height,
|
|
532
|
+
time,
|
|
533
|
+
passedProps
|
|
534
|
+
}) => {
|
|
535
|
+
const { direction = DEFAULT_DIRECTION, blur = DEFAULT_BLUR } = passedProps;
|
|
536
|
+
if (!prevImage && !nextImage) {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (prevImage && (prevImage.width === 0 || prevImage.height === 0)) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (nextImage && (nextImage.width === 0 || nextImage.height === 0)) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const effectiveTime = !prevImage ? 0 : !nextImage ? 1 : time;
|
|
546
|
+
const p = 1 - effectiveTime;
|
|
547
|
+
const progress = p * p * p * (p * (p * 6 - 15) + 10);
|
|
548
|
+
const blurLength = blur * 2 * Math.min(progress, 1 - progress);
|
|
549
|
+
const coarseTapSpacing = blurLength / (SAMPLES - 1);
|
|
550
|
+
const [dirX, dirY] = getDirectionVector(direction);
|
|
551
|
+
gl.bindVertexArray(vao);
|
|
552
|
+
if (intermediateWidth !== width || intermediateHeight !== height) {
|
|
553
|
+
gl.bindTexture(gl.TEXTURE_2D, intermediateTex);
|
|
554
|
+
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
555
|
+
intermediateWidth = width;
|
|
556
|
+
intermediateHeight = height;
|
|
557
|
+
}
|
|
558
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
559
|
+
gl.viewport(0, 0, width, height);
|
|
560
|
+
gl.clearColor(0, 0, 0, 0);
|
|
561
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
562
|
+
gl.useProgram(slideProgram);
|
|
563
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
564
|
+
gl.bindTexture(gl.TEXTURE_2D, prevTex);
|
|
565
|
+
if (prevImage) {
|
|
566
|
+
uploadElementImage(gl, prevImage);
|
|
567
|
+
}
|
|
568
|
+
gl.uniform1i(uPrev, 0);
|
|
569
|
+
gl.activeTexture(gl.TEXTURE1);
|
|
570
|
+
gl.bindTexture(gl.TEXTURE_2D, nextTex);
|
|
571
|
+
if (nextImage) {
|
|
572
|
+
uploadElementImage(gl, nextImage);
|
|
573
|
+
}
|
|
574
|
+
gl.uniform1i(uNext, 1);
|
|
575
|
+
gl.uniform1f(uProgress, progress);
|
|
576
|
+
gl.uniform2f(uSlideDirection, dirX, dirY);
|
|
577
|
+
gl.uniform1f(uSlideBlurLength, blurLength);
|
|
578
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
579
|
+
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
|
580
|
+
gl.viewport(0, 0, width, height);
|
|
581
|
+
gl.clearColor(0, 0, 0, 0);
|
|
582
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
583
|
+
gl.useProgram(blurProgram);
|
|
584
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
585
|
+
gl.bindTexture(gl.TEXTURE_2D, intermediateTex);
|
|
586
|
+
gl.uniform1i(uSource, 0);
|
|
587
|
+
gl.uniform2f(uBlurDirection, dirX, dirY);
|
|
588
|
+
gl.uniform1f(uBlurBlurLength, coarseTapSpacing);
|
|
589
|
+
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
|
590
|
+
};
|
|
591
|
+
return {
|
|
592
|
+
clear,
|
|
593
|
+
cleanup,
|
|
594
|
+
draw
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
var makeBlurSlide = makeHtmlInCanvasPresentation(blurSlideShader);
|
|
598
|
+
var blurSlide = (props = {}) => {
|
|
599
|
+
validateProps(props);
|
|
600
|
+
return makeBlurSlide(props);
|
|
601
|
+
};
|
|
602
|
+
|
|
337
603
|
// src/presentations/cross-zoom.tsx
|
|
338
604
|
var DEFAULT_STRENGTH = 0.4;
|
|
339
|
-
var
|
|
605
|
+
var VERTEX_SHADER2 = `#version 300 es
|
|
340
606
|
in vec2 a_pos;
|
|
341
607
|
out vec2 v_uv;
|
|
342
608
|
void main() {
|
|
@@ -413,7 +679,7 @@ void main() {
|
|
|
413
679
|
float progress = 1.0 - u_time;
|
|
414
680
|
outColor = transition(v_uv, progress);
|
|
415
681
|
}`;
|
|
416
|
-
var
|
|
682
|
+
var compileShader2 = (gl, source, type) => {
|
|
417
683
|
const shader = gl.createShader(type);
|
|
418
684
|
if (!shader) {
|
|
419
685
|
throw new Error("Failed to create shader");
|
|
@@ -427,13 +693,13 @@ var compileShader = (gl, source, type) => {
|
|
|
427
693
|
}
|
|
428
694
|
return shader;
|
|
429
695
|
};
|
|
430
|
-
var
|
|
696
|
+
var createProgram2 = (gl) => {
|
|
431
697
|
const program = gl.createProgram();
|
|
432
698
|
if (!program) {
|
|
433
699
|
throw new Error("Failed to create WebGL program");
|
|
434
700
|
}
|
|
435
|
-
const vs =
|
|
436
|
-
const fs =
|
|
701
|
+
const vs = compileShader2(gl, VERTEX_SHADER2, gl.VERTEX_SHADER);
|
|
702
|
+
const fs = compileShader2(gl, FRAGMENT_SHADER, gl.FRAGMENT_SHADER);
|
|
437
703
|
gl.attachShader(program, vs);
|
|
438
704
|
gl.attachShader(program, fs);
|
|
439
705
|
gl.linkProgram(program);
|
|
@@ -444,7 +710,7 @@ var createProgram = (gl) => {
|
|
|
444
710
|
}
|
|
445
711
|
return program;
|
|
446
712
|
};
|
|
447
|
-
var
|
|
713
|
+
var createTexture2 = (gl) => {
|
|
448
714
|
const tex = gl.createTexture();
|
|
449
715
|
if (!tex) {
|
|
450
716
|
throw new Error("Failed to create texture");
|
|
@@ -462,9 +728,9 @@ var crossZoomShader = (canvas) => {
|
|
|
462
728
|
if (!gl) {
|
|
463
729
|
throw new Error("Failed to create WebGL2 context");
|
|
464
730
|
}
|
|
465
|
-
const program =
|
|
466
|
-
const prevTex =
|
|
467
|
-
const nextTex =
|
|
731
|
+
const program = createProgram2(gl);
|
|
732
|
+
const prevTex = createTexture2(gl);
|
|
733
|
+
const nextTex = createTexture2(gl);
|
|
468
734
|
const vao = gl.createVertexArray();
|
|
469
735
|
gl.bindVertexArray(vao);
|
|
470
736
|
const buffer = gl.createBuffer();
|
|
@@ -536,7 +802,7 @@ var crossZoom = makeHtmlInCanvasPresentation(crossZoomShader);
|
|
|
536
802
|
// src/presentations/dreamy-zoom.tsx
|
|
537
803
|
var DEFAULT_ROTATION = 6;
|
|
538
804
|
var DEFAULT_SCALE = 1.2;
|
|
539
|
-
var
|
|
805
|
+
var VERTEX_SHADER3 = `#version 300 es
|
|
540
806
|
in vec2 a_pos;
|
|
541
807
|
out vec2 v_uv;
|
|
542
808
|
void main() {
|
|
@@ -579,7 +845,7 @@ void main() {
|
|
|
579
845
|
float progress = 1.0 - u_time;
|
|
580
846
|
outColor = transition(v_uv, progress);
|
|
581
847
|
}`;
|
|
582
|
-
var
|
|
848
|
+
var compileShader3 = (gl, source, type) => {
|
|
583
849
|
const shader = gl.createShader(type);
|
|
584
850
|
if (!shader) {
|
|
585
851
|
throw new Error("Failed to create shader");
|
|
@@ -593,13 +859,13 @@ var compileShader2 = (gl, source, type) => {
|
|
|
593
859
|
}
|
|
594
860
|
return shader;
|
|
595
861
|
};
|
|
596
|
-
var
|
|
862
|
+
var createProgram3 = (gl) => {
|
|
597
863
|
const program = gl.createProgram();
|
|
598
864
|
if (!program) {
|
|
599
865
|
throw new Error("Failed to create WebGL program");
|
|
600
866
|
}
|
|
601
|
-
const vs =
|
|
602
|
-
const fs =
|
|
867
|
+
const vs = compileShader3(gl, VERTEX_SHADER3, gl.VERTEX_SHADER);
|
|
868
|
+
const fs = compileShader3(gl, FRAGMENT_SHADER2, gl.FRAGMENT_SHADER);
|
|
603
869
|
gl.attachShader(program, vs);
|
|
604
870
|
gl.attachShader(program, fs);
|
|
605
871
|
gl.linkProgram(program);
|
|
@@ -610,7 +876,7 @@ var createProgram2 = (gl) => {
|
|
|
610
876
|
}
|
|
611
877
|
return program;
|
|
612
878
|
};
|
|
613
|
-
var
|
|
879
|
+
var createTexture3 = (gl) => {
|
|
614
880
|
const tex = gl.createTexture();
|
|
615
881
|
if (!tex) {
|
|
616
882
|
throw new Error("Failed to create texture");
|
|
@@ -628,9 +894,9 @@ var dreamyZoomShader = (canvas) => {
|
|
|
628
894
|
if (!gl) {
|
|
629
895
|
throw new Error("Failed to create WebGL2 context");
|
|
630
896
|
}
|
|
631
|
-
const program =
|
|
632
|
-
const prevTex =
|
|
633
|
-
const nextTex =
|
|
897
|
+
const program = createProgram3(gl);
|
|
898
|
+
const prevTex = createTexture3(gl);
|
|
899
|
+
const nextTex = createTexture3(gl);
|
|
634
900
|
const vao = gl.createVertexArray();
|
|
635
901
|
gl.bindVertexArray(vao);
|
|
636
902
|
const buffer = gl.createBuffer();
|
|
@@ -705,7 +971,7 @@ var dreamyZoom = makeHtmlInCanvasPresentation(dreamyZoomShader);
|
|
|
705
971
|
|
|
706
972
|
// src/presentations/film-burn.tsx
|
|
707
973
|
var DEFAULT_SEED = 2.31;
|
|
708
|
-
var
|
|
974
|
+
var VERTEX_SHADER4 = `#version 300 es
|
|
709
975
|
in vec2 a_pos;
|
|
710
976
|
out vec2 v_uv;
|
|
711
977
|
void main() {
|
|
@@ -848,7 +1114,7 @@ void main() {
|
|
|
848
1114
|
float progress = 1.0 - u_time;
|
|
849
1115
|
outColor = transition(v_uv, progress);
|
|
850
1116
|
}`;
|
|
851
|
-
var
|
|
1117
|
+
var compileShader4 = (gl, source, type) => {
|
|
852
1118
|
const shader = gl.createShader(type);
|
|
853
1119
|
if (!shader) {
|
|
854
1120
|
throw new Error("Failed to create shader");
|
|
@@ -862,13 +1128,13 @@ var compileShader3 = (gl, source, type) => {
|
|
|
862
1128
|
}
|
|
863
1129
|
return shader;
|
|
864
1130
|
};
|
|
865
|
-
var
|
|
1131
|
+
var createProgram4 = (gl) => {
|
|
866
1132
|
const program = gl.createProgram();
|
|
867
1133
|
if (!program) {
|
|
868
1134
|
throw new Error("Failed to create WebGL program");
|
|
869
1135
|
}
|
|
870
|
-
const vs =
|
|
871
|
-
const fs =
|
|
1136
|
+
const vs = compileShader4(gl, VERTEX_SHADER4, gl.VERTEX_SHADER);
|
|
1137
|
+
const fs = compileShader4(gl, FRAGMENT_SHADER3, gl.FRAGMENT_SHADER);
|
|
872
1138
|
gl.attachShader(program, vs);
|
|
873
1139
|
gl.attachShader(program, fs);
|
|
874
1140
|
gl.linkProgram(program);
|
|
@@ -879,7 +1145,7 @@ var createProgram3 = (gl) => {
|
|
|
879
1145
|
}
|
|
880
1146
|
return program;
|
|
881
1147
|
};
|
|
882
|
-
var
|
|
1148
|
+
var createTexture4 = (gl) => {
|
|
883
1149
|
const tex = gl.createTexture();
|
|
884
1150
|
if (!tex) {
|
|
885
1151
|
throw new Error("Failed to create texture");
|
|
@@ -897,9 +1163,9 @@ var filmBurnShader = (canvas) => {
|
|
|
897
1163
|
if (!gl) {
|
|
898
1164
|
throw new Error("Failed to create WebGL2 context");
|
|
899
1165
|
}
|
|
900
|
-
const program =
|
|
901
|
-
const prevTex =
|
|
902
|
-
const nextTex =
|
|
1166
|
+
const program = createProgram4(gl);
|
|
1167
|
+
const prevTex = createTexture4(gl);
|
|
1168
|
+
const nextTex = createTexture4(gl);
|
|
903
1169
|
const vao = gl.createVertexArray();
|
|
904
1170
|
gl.bindVertexArray(vao);
|
|
905
1171
|
const buffer = gl.createBuffer();
|
|
@@ -969,7 +1235,7 @@ var filmBurnShader = (canvas) => {
|
|
|
969
1235
|
var filmBurn = makeHtmlInCanvasPresentation(filmBurnShader);
|
|
970
1236
|
|
|
971
1237
|
// src/presentations/linear-blur.tsx
|
|
972
|
-
var
|
|
1238
|
+
var VERTEX_SHADER5 = `#version 300 es
|
|
973
1239
|
in vec2 a_pos;
|
|
974
1240
|
out vec2 v_uv;
|
|
975
1241
|
void main() {
|
|
@@ -1013,7 +1279,7 @@ void main() {
|
|
|
1013
1279
|
float progress = 1.0 - u_time;
|
|
1014
1280
|
outColor = transition(v_uv, progress);
|
|
1015
1281
|
}`;
|
|
1016
|
-
var
|
|
1282
|
+
var compileShader5 = (gl, source, type) => {
|
|
1017
1283
|
const shader = gl.createShader(type);
|
|
1018
1284
|
if (!shader) {
|
|
1019
1285
|
throw new Error("Failed to create shader");
|
|
@@ -1027,13 +1293,13 @@ var compileShader4 = (gl, source, type) => {
|
|
|
1027
1293
|
}
|
|
1028
1294
|
return shader;
|
|
1029
1295
|
};
|
|
1030
|
-
var
|
|
1296
|
+
var createProgram5 = (gl) => {
|
|
1031
1297
|
const program = gl.createProgram();
|
|
1032
1298
|
if (!program) {
|
|
1033
1299
|
throw new Error("Failed to create WebGL program");
|
|
1034
1300
|
}
|
|
1035
|
-
const vs =
|
|
1036
|
-
const fs =
|
|
1301
|
+
const vs = compileShader5(gl, VERTEX_SHADER5, gl.VERTEX_SHADER);
|
|
1302
|
+
const fs = compileShader5(gl, FRAGMENT_SHADER4, gl.FRAGMENT_SHADER);
|
|
1037
1303
|
gl.attachShader(program, vs);
|
|
1038
1304
|
gl.attachShader(program, fs);
|
|
1039
1305
|
gl.linkProgram(program);
|
|
@@ -1044,7 +1310,7 @@ var createProgram4 = (gl) => {
|
|
|
1044
1310
|
}
|
|
1045
1311
|
return program;
|
|
1046
1312
|
};
|
|
1047
|
-
var
|
|
1313
|
+
var createTexture5 = (gl) => {
|
|
1048
1314
|
const tex = gl.createTexture();
|
|
1049
1315
|
if (!tex) {
|
|
1050
1316
|
throw new Error("Failed to create texture");
|
|
@@ -1062,9 +1328,9 @@ var linearBlurShader = (canvas) => {
|
|
|
1062
1328
|
if (!gl) {
|
|
1063
1329
|
throw new Error("Failed to create WebGL2 context");
|
|
1064
1330
|
}
|
|
1065
|
-
const program =
|
|
1066
|
-
const prevTex =
|
|
1067
|
-
const nextTex =
|
|
1331
|
+
const program = createProgram5(gl);
|
|
1332
|
+
const prevTex = createTexture5(gl);
|
|
1333
|
+
const nextTex = createTexture5(gl);
|
|
1068
1334
|
const vao = gl.createVertexArray();
|
|
1069
1335
|
gl.bindVertexArray(vao);
|
|
1070
1336
|
const buffer = gl.createBuffer();
|
|
@@ -1146,7 +1412,7 @@ var validateFiniteNumber = (name, value) => {
|
|
|
1146
1412
|
throw new TypeError(`${name} passed to pushCut() must be finite, received ${value}`);
|
|
1147
1413
|
}
|
|
1148
1414
|
};
|
|
1149
|
-
var
|
|
1415
|
+
var validateProps2 = (props) => {
|
|
1150
1416
|
const cutProgress = props.cutProgress ?? 5 / 11;
|
|
1151
1417
|
const outgoingScale = props.outgoingScale ?? 1.04;
|
|
1152
1418
|
const incomingStartScale = props.incomingStartScale ?? 1.04;
|
|
@@ -1250,7 +1516,7 @@ var PushCutPresentation = ({
|
|
|
1250
1516
|
};
|
|
1251
1517
|
var pushCut = (props) => {
|
|
1252
1518
|
const passedProps = props ?? {};
|
|
1253
|
-
|
|
1519
|
+
validateProps2(passedProps);
|
|
1254
1520
|
return {
|
|
1255
1521
|
component: PushCutPresentation,
|
|
1256
1522
|
props: passedProps
|
|
@@ -1880,5 +2146,6 @@ export {
|
|
|
1880
2146
|
filmBurn,
|
|
1881
2147
|
dreamyZoom,
|
|
1882
2148
|
crossZoom,
|
|
2149
|
+
blurSlide,
|
|
1883
2150
|
TransitionSeries
|
|
1884
2151
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { useTransitionProgress } from './use-transition-progress.js';
|
|
|
6
6
|
export type { TransitionState } from './use-transition-progress.js';
|
|
7
7
|
export { makeHtmlInCanvasPresentation } from './html-in-canvas-presentation.js';
|
|
8
8
|
export type { HtmlInCanvasShader, HtmlInCanvasShaderDraw, HtmlInCanvasShaderDrawParams, } from './html-in-canvas-presentation.js';
|
|
9
|
+
export { blurSlide } from './presentations/blur-slide.js';
|
|
10
|
+
export type { BlurSlideDirection, BlurSlideProps, } from './presentations/blur-slide.js';
|
|
9
11
|
export { crossZoom } from './presentations/cross-zoom.js';
|
|
10
12
|
export type { CrossZoomProps } from './presentations/cross-zoom.js';
|
|
11
13
|
export { dreamyZoom } from './presentations/dreamy-zoom.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pushCut = exports.linearBlur = exports.filmBurn = exports.dreamyZoom = exports.crossZoom = exports.makeHtmlInCanvasPresentation = exports.useTransitionProgress = exports.TransitionSeries = exports.springTiming = exports.linearTiming = void 0;
|
|
3
|
+
exports.pushCut = exports.linearBlur = exports.filmBurn = exports.dreamyZoom = exports.crossZoom = exports.blurSlide = exports.makeHtmlInCanvasPresentation = exports.useTransitionProgress = exports.TransitionSeries = exports.springTiming = exports.linearTiming = void 0;
|
|
4
4
|
// Timings
|
|
5
5
|
const linear_timing_js_1 = require("./timings/linear-timing.js");
|
|
6
6
|
Object.defineProperty(exports, "linearTiming", { enumerable: true, get: function () { return linear_timing_js_1.linearTiming; } });
|
|
@@ -15,6 +15,8 @@ Object.defineProperty(exports, "useTransitionProgress", { enumerable: true, get:
|
|
|
15
15
|
// HTML-in-canvas
|
|
16
16
|
const html_in_canvas_presentation_js_1 = require("./html-in-canvas-presentation.js");
|
|
17
17
|
Object.defineProperty(exports, "makeHtmlInCanvasPresentation", { enumerable: true, get: function () { return html_in_canvas_presentation_js_1.makeHtmlInCanvasPresentation; } });
|
|
18
|
+
const blur_slide_js_1 = require("./presentations/blur-slide.js");
|
|
19
|
+
Object.defineProperty(exports, "blurSlide", { enumerable: true, get: function () { return blur_slide_js_1.blurSlide; } });
|
|
18
20
|
const cross_zoom_js_1 = require("./presentations/cross-zoom.js");
|
|
19
21
|
Object.defineProperty(exports, "crossZoom", { enumerable: true, get: function () { return cross_zoom_js_1.crossZoom; } });
|
|
20
22
|
const dreamy_zoom_js_1 = require("./presentations/dreamy-zoom.js");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EffectsProp } from 'remotion';
|
|
2
|
+
import type { TransitionPresentation } from '../types';
|
|
3
|
+
import type { SlideDirection } from './slide';
|
|
4
|
+
export type BlurSlideDirection = SlideDirection;
|
|
5
|
+
export type BlurSlideProps = {
|
|
6
|
+
direction?: BlurSlideDirection;
|
|
7
|
+
blur?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const blurSlideShader: (canvas: OffscreenCanvas) => {
|
|
10
|
+
clear: () => void;
|
|
11
|
+
cleanup: () => void;
|
|
12
|
+
draw: import("..").HtmlInCanvasShaderDraw<BlurSlideProps>;
|
|
13
|
+
};
|
|
14
|
+
export declare const blurSlide: (props?: BlurSlideProps & {
|
|
15
|
+
effects?: EffectsProp | undefined;
|
|
16
|
+
}) => TransitionPresentation<BlurSlideProps & {
|
|
17
|
+
effects?: EffectsProp | undefined;
|
|
18
|
+
}>;
|