Skip to content

Instantly share code, notes, and snippets.

@mohayonao
Last active December 27, 2015 10:09
Show Gist options
  • Save mohayonao/7309047 to your computer and use it in GitHub Desktop.
Save mohayonao/7309047 to your computer and use it in GitHub Desktop.
Task関数の書き換え
Task.do ->
[s1] = []
[
=>
s1 = def.play()
@wait 100
=>
s1.set freq:220
@wait 200
=>
@wait Task.each [1,2,3,4], ->
[s2] = [] # ここに s1 を含めてはいけない
[
(i)=>
s2 = def.play(freq:220*i)
@wait 50
(i)=>
s1 = def.play(freq:440*i)
@wait 100
]
.play()
]
.play()
Task.do ->
s1 = def.play()
@wait 100
s1.set freq:220
@wait 200
@wait Task.each [1,2,3,4], (i)->
s2 = def.play(freq:220*i) # これはローカルスコープ
@wait 50
s1 = def.plau(freq:440*i) # これは上のスコープ
@wait 100
.play()
.play()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment