今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
Playing sound with the mouse
- [Instructor] Let's go ahead and modify our sound so that we can control it with the mouse. So for that I'm going to need a new variable here called myOscillator. And I probably should have created that before 'cause I'm using this variable here really pretty much everywhere and it doesn't really exist before that. JavaScript will automatically create it for you, but that's bad form so I'm creating one here officially. And what I also need is another variable to hold the node that's going to contain my sound. So I'll create a variable called appNode. And this will select from the document using querySelector, the item with the class of app. So it looks like that and what I wanna do next is move all of this sort of sound customizing stuff out of here, so we'll take it all out of there. And then create some events that are going to control when my sound plays. So first off I'm doing an appNode, or at least on the appNode I want to add an EventListener and the first event I want is…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。