note.js 695 B

1234567891011121314151617181920212223242526272829
  1. this.initialize = function(){
  2. //this.dragButton.init();
  3. this.positionChanged()
  4. }
  5. this.hitstartEventMethod = function(value){
  6. //console.log(value)
  7. this.material.color = "red"
  8. }
  9. this.hitendEventMethod = function(value){
  10. this.material.color = "green"
  11. //console.log(value)
  12. // if(this.synth){
  13. // let scene = this.getScene();
  14. // let synth = scene.findNodeByID(this.synth);
  15. // synth.triggerRelease(this.note.note);
  16. // }
  17. // this.synth = null;
  18. }
  19. this.positionChanged = function(){
  20. let note = Tone.Frequency(Math.abs(this.worldPosition().y)*150).toNote();
  21. this.note.note = note;
  22. if(this.text)
  23. this.text.value = note;
  24. }