Created
September 11, 2020 18:47
-
-
Save furenku/f5ce5a4d2160d976f43139496260a367 to your computer and use it in GitHub Desktop.
3videos
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>Document</title> | |
| </head> | |
| <body> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js"></script> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/addons/p5.sound.min.js"></script> | |
| <script src="cargado.js"></script> | |
| </body> | |
| </html> |
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
| let archivos = [ | |
| "videos/vd1.mp4", | |
| "videos/vd2.mp4", | |
| "videos/vd3.mp4", | |
| "videos/vd4.mp4", | |
| ] | |
| let archivoReacciones1 = "videos/gt1.mp4" | |
| let archivoReacciones2 = "videos/gt2.mp4" | |
| let vidReacciones1 | |
| let vidReacciones2 | |
| let videoActual | |
| let videos = [] | |
| function preload() { | |
| for( let i in archivos ) { | |
| let archivo = archivos[i] | |
| let video = createVideo( archivo ) | |
| videos.push( video ) | |
| video.hide() | |
| } | |
| vidReacciones1 = createVideo(archivoReacciones1) | |
| vidReacciones1.loop() | |
| vidReacciones1.hide() | |
| vidReacciones2 = createVideo(archivoReacciones2) | |
| vidReacciones2.loop() | |
| vidReacciones2.hide() | |
| } | |
| function setup() { | |
| createCanvas(1200,300); | |
| background( 0 ) | |
| } | |
| function keyTyped() { | |
| if( key == "s" ) { | |
| videoActual = videos[Math.floor(random(4))] | |
| videoActual.loop() | |
| } | |
| } | |
| function draw() { | |
| image( vidReacciones1, 0, 0, width/3, height ) | |
| image( vidReacciones2, width*(2/3), 0, width/3, height ) | |
| if( videoActual ) { | |
| image( videoActual, width/3, 0, width/3, height ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment