Skip to content

Instantly share code, notes, and snippets.

@furenku
Created September 11, 2020 18:35
Show Gist options
  • Select an option

  • Save furenku/77cd2ae1f71169109711a6bb34136be3 to your computer and use it in GitHub Desktop.

Select an option

Save furenku/77cd2ae1f71169109711a6bb34136be3 to your computer and use it in GitHub Desktop.
cargado
<!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>
let archivos = [
"videos/vd1.mp4",
"videos/vd2.mp4",
"videos/vd3.mp4",
"videos/vd4.mp4",
]
let videos = []
function preload() {
for( let i in archivos ) {
let archivo = archivos[i]
let video = createVideo( archivo )
videos.push( video )
video.hide()
}
}
function setup() {
createCanvas(500,500);
background( 0 )
}
function keyTyped() {
if( key == "s" ) {
for( let v of videos ) {
v.loop()
v.volume(0)
}
}
}
function draw() {
for( let i in videos ) {
let video = videos[i]
let ancho = width / videos.length
image( video, i * ancho, 0, ancho, ancho )
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment