Tone.js/examples/require.html

37 lines
823 B
HTML
Raw Normal View History

2014-04-05 00:24:19 +00:00
<html>
<head>
<title>USING WITH REQUIRE</title>
2014-04-05 00:24:19 +00:00
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../deps/require.js"></script>
2014-04-05 00:24:19 +00:00
</head>
<body>
<div id='meter'></div>
2014-04-05 00:24:19 +00:00
<script type="text/javascript">
//minimal example using requirejs
2014-04-06 20:51:30 +00:00
require.config({
baseUrl : "../"
});
require(["Tone/core/Tone", "Tone/signal/Signal", "Tone/signal/Scale", "Tone/component/Meter"],
function(Tone, Signal, Scale, Meter){
var meter = new Meter();
var sig1 = new Signal(.5);
var scale = new Scale(0, 1, 10, 100);
sig1.connect(scale)
scale.connect(meter);
var meterEl = document.querySelector("#meter");
setInterval(function(){
meterEl.textContent = meter.getValue();
}, 100);
window.scale = scale;
2014-04-16 04:23:58 +00:00
});
2014-04-05 00:24:19 +00:00
</script>
</body>
</html>