/**
* Created by Administrator on 2015/8/4.
*/
function Coin(opts){
this._init();
}
Coin.prototype={
constructor:Coin,
/**
* 动画初始化方法
* @method _init
**/
_init:function(){
this._createAudio();
},
/**
* 创建音频对象
* @method _createAudio
**/
_createAudio:function(){
this.audio=document.createElement('audio');
this.audio.setAttribute("preload","load");
var oSource=document.createElement('source');
oSource.setAttribute("src","images/shake.mp3");
oSource.setAttribute("type","audio/mp3");
this.audio.appendChild(oSource);
var oBody=document.getElementsByTagName('body')[0];
oBody.appendChild(this.audio);
this._playAudio();
},
/**
* 播放音频
* @method _playAudio
**/
_playAudio:function(){
this.audio.play();
},
/**
* 销毁canvas和audio
* @method _destory
**/
_destory:function(){
var oBody=document.getElementsByTagName('body')[0];
oBody.removeChild(this.audio);
}
}