From 717bee29ad464a26f73eea73a28d1fff5910b03d Mon Sep 17 00:00:00 2001 From: Tim Holman Date: Sun, 23 Feb 2020 00:13:56 -0500 Subject: [PATCH] a basic mosquito, i got a bad feeling about this --- mosquito/index.html | 14 ++++++++++++++ mosquito/mosquito.js | 15 +++++++++++++++ mosquito/style.css | 22 ++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 mosquito/index.html create mode 100644 mosquito/mosquito.js create mode 100644 mosquito/style.css diff --git a/mosquito/index.html b/mosquito/index.html new file mode 100644 index 0000000..b34f752 --- /dev/null +++ b/mosquito/index.html @@ -0,0 +1,14 @@ + + + + + Mosquito JS + + + +
+ +
+ + + \ No newline at end of file diff --git a/mosquito/mosquito.js b/mosquito/mosquito.js new file mode 100644 index 0000000..2804a2b --- /dev/null +++ b/mosquito/mosquito.js @@ -0,0 +1,15 @@ + +let context = new (window.AudioContext || window.webkitAudioContext)(); + +let oscillator = context.createOscillator(); +oscillator.type = "sawtooth"; +oscillator.frequency.setValueAtTime(750, context.currentTime); + +const gainNode = context.createGain(); +gainNode.connect(context.destination); + +oscillator.connect(gainNode); + +document.querySelector("button").onclick = () => { + oscillator.start(); +}; \ No newline at end of file diff --git a/mosquito/style.css b/mosquito/style.css new file mode 100644 index 0000000..c8a826d --- /dev/null +++ b/mosquito/style.css @@ -0,0 +1,22 @@ +* { + box-sizing: border-box; +} + +html, +body { + margin: 0; +} + +.center { + display: flex; + justify-content: center; + align-items: center; +} + +header { + width: 100%; + height: 100vh; + background: #fff; + flex-direction: column; + border: 20px solid #eee; +}