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
/* | |
<html> | |
<audio controls src="https://assets.uitsprekend.webleren.be/s3fs-public/2023-03/TH-Z-TE-2%20%282%29_0.mp3" /> | |
</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
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' | |
const wavesurfer = WaveSurfer.create({ | |
container: document.body, | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', | |
url: 'https://assets.uitsprekend.webleren.be/s3fs-public/2023-03/TH-Z-TE-2%20%282%29_0.mp3', | |
}) | |
wavesurfer.on('click', () => { |
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
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' | |
import TimelinePlugin from 'https://unpkg.com/wavesurfer.js@7/dist/plugins/timeline.esm.js' | |
// Create an instance of WaveSurfer | |
const wavesurfer = WaveSurfer.create({ | |
container: '#waveform', | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', | |
url: '/examples/audio/audio.wav', | |
minPxPerSec: 100, |
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
// Custom rendering function | |
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' | |
const wavesurfer = WaveSurfer.create({ | |
container: document.body, | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', | |
url: '/examples/audio/demo.wav', | |
renderFunction: (channels, ctx) => { |
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
/* | |
<html> | |
<div style="display: flex"> | |
<div id="container" style="width: 600px"></div> | |
</div> | |
</html> | |
*/ | |
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' |
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
// Record plugin | |
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' | |
import RecordPlugin from 'https://unpkg.com/wavesurfer.js@7/dist/plugins/record.esm.js' | |
// Create an instance of WaveSurfer | |
const wavesurfer = WaveSurfer.create({ | |
container: '#mic', | |
waveColor: 'rgb(200, 0, 200)', | |
progressColor: 'rgb(100, 0, 100)', |
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
/* | |
<html> | |
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Tsunami_by_hokusai_19th_century.jpg/2880px-Tsunami_by_hokusai_19th_century.jpg" width="300" /> | |
<p>Drag the blue line to change the image opacity 👇</p> | |
</html> | |
*/ | |
import WaveSurfer from 'https://unpkg.com/wavesurfer.js@7/dist/wavesurfer.esm.js' | |
import EnvelopePlugin from 'https://unpkg.com/wavesurfer.js@7/dist/plugins/envelope.esm.js' |
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
// Waveform for a video | |
// Create a video element | |
/* | |
<html> | |
<video | |
width="620" | |
controls | |
poster="https://upload.wikimedia.org/wikipedia/commons/e/e8/Elephants_Dream_s5_both.jpg"> | |
<source |
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
// Generate unique avatars based on Ethereum addresses. | |
// It uses celluar automata to generate the avatars which are unique for each address. | |
// Define the color pallets. | |
// Each pallet is an array of 3 colors: background, foreground, and highlight. | |
// The colors are in the RGB format, and we use soft pastel colors. | |
const palettes = [ | |
// Palette 1 | |
[ | |
[255, 182, 193], // Background: Light Pink |
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
// Drag-n-drop | |
/* | |
<html> | |
<div id="container" draggable="true" style="width: 300px; cursor: grab; border: 10px solid red;"> | |
Drag me | |
</div> | |
<div id="droparea" style="border: 2px dashed; margin: 2em; padding: 4em 2em; text-align: center"> | |
Drop here |