DIR : /home/kozerus/public_html/snd3.html
/home/kozerus/public_html
<!-- Key template -->
<script type='text/html' id='key-template'>
<kbd>{{ key.key }}</kbd>
<span class='sound'>{{ key.name }}</span>
<audio src="sounds/{{ key.name }}.wav"></audio>
</script>
var keyTemplate = document.querySelector( '#key-template' );
var keys = [
{
key: 'Q',
name: 'Blurp',
code: 81,
},
{
key: 'W',
name: 'Reow',
code: 87,
},
{
key: 'E',
name: 'Slippery',
code: 69,
},
// ... etc
];
/**
* Key binding method
*
* Expects to be called via `Key.call()` on items from `keys` array
*/
var Key = function() {
var key = this;
/**
* Create the DOM element from the template
*/
key.element = document.createElement('div');
key.element.classList.add('key');
// replace the template tags with the data for this key
key.element.innerHTML = keyTemplate.innerHTML.replace(
/{{ key\.(key|name|code) }}/g,
( fullMatch, match ) => key[ match ]
);
// ... etc ...
// the audio element for this key
key.audio = key.element.querySelector('audio');
// play the sound file associated with this key
key.play = function () {
// ... etc ...
}
} // end: Key()
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer