Created
April 26, 2017 14:32
-
-
Save kurai021/1187ec95e0f438d18ecd79b92f799c0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vocaloid_changer = document.getElementById('vocaloid_changer'); | |
AFRAME.registerComponent('vocaloid', { | |
schema: {}, | |
init: function(){ | |
var self = this; | |
vocaloid_changer.addEventListener('change', function(){ | |
if(vocaloid_changer.value == 'miku'){ | |
$('a-entity[mmd]').remove(); | |
var music; | |
var model; | |
music = document.createElement("a-entity"); | |
music.setAttribute('mmd', 'audio:images/vocaloid_songs/world_is_mine.mp3; audioDelayTime:5.333333333333333; afterglow:2.0;'); | |
self.el.append(music); | |
model = document.createElement("a-entity"); | |
model.setAttribute('mmd-model', 'model:/images/miku/miku_v3.pmx;vmd:/images/miku/world_is_mine.vmd;'); | |
music.append(model); | |
} | |
else if (vocaloid_changer.value == 'len-rin') { | |
$('a-entity[mmd]').remove(); | |
var music; | |
var model; | |
var model2; | |
music = document.createElement("a-entity"); | |
music.setAttribute('mmd', 'audio:images/vocaloid_songs/migikata_no_chou.mp3; audioDelayTime:5.333333333333333; afterglow:2.0;'); | |
self.el.append(music); | |
model = document.createElement("a-entity"); | |
model.setAttribute('mmd-model', 'model:/images/rin/rin_2.pmx;vmd:images/rin/Rin_Migikata_no_chou.vmd;'); | |
music.append(model); | |
model2 = document.createElement("a-entity"); | |
model2.setAttribute('mmd-model', 'model:/images/len/len_2.pmx;vmd:images/len/Len_Migikata_no_chou.vmd;'); | |
music.append(model2); | |
} | |
else { | |
alert("imposible crear la entidad"); | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment