Tone.js/examples/require.html
2014-09-04 14:04:15 -04:00

36 lines
No EOL
800 B
HTML

<html>
<head>
<title>USING WITH REQUIRE</title>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../deps/require.js"></script>
</head>
<body>
<div id='meter'></div>
<script type="text/javascript">
//minimal example using requirejs
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(0.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);
});
</script>
</body>
</html>