Created
May 10, 2012 01:25
-
-
Save nomadalex/2650286 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 Face = | |
{ | |
version : '1.0.0', | |
noInit : true, | |
face : ['(',')','[',']','|','|'], | |
eyes : [' ̄',' ̄','—','—','_','_','﹁','﹁','^','^','~','~','=','=','@','@','·','·','`','′','>','<','→','←','〒','〒','┬','┬','T','T','゜','゜','。','。','●','●','◎','◎','⊙','⊙','○','○','╯','╰','︶','︶','〃','〃','Φ','Φ','Θ','Θ','+','+','x','x','$','$','≥','≤','u','u','U','U','・ิ', '・ิ', '❛', '❛', '⊙', '⊙', ' ̄', ' ̄', '◕ˇ', 'ˇ◕'], | |
mouth : [ | |
// mouth | |
'—','-','_','。',',','.','o','O','3','ε','ェ','v','u','_',',','ω','Д','﹏','ヘ','︶','∧','▽','△','∀','<','>','○','ロ','□','Q','@','皿','◇','︹','^','﹌','c','ー','C','c','t','ڡ', | |
// nose | |
'(○○)','(工)','-','ゝ','(··)' | |
], | |
blah : ["''",'b','||','#','╬','*','//',';;','::','メ','〆','z'], | |
lhand : ['\\','n','m','v','w','<','m@','o','O','○','~','凸','╭∩╮','d','ㄏ','╰','╭','つ','ゞ','ノ','┌','ψ','彡','=','—','~','∧','っ','づ','┗','┍','๑','▰','✿','#'], | |
rhand : ['/','n','m','v','y','w','>','@m','☞','o','O','○','~','凸','╭∩╮','b','ㄟ','╮','╯','ノ','↗','↘','つ','σ','ゞ','ノ','┘','ψ','彡','=','—','~','∧','っ','づ','┛','┑','๑','▰','✿','#'], | |
faceLen : 0, | |
eyeLen : 0, | |
mouthLen : 0, | |
blahLen : 0, | |
lhandLen : 0, | |
rhandLen : 0, | |
faceRnd : .65, | |
mouthRnd : .8, | |
blahRnd : .2, | |
lhandRnd : .4, | |
rhandRnd : .4 | |
}; | |
Face.init = function() | |
{ | |
this.noInit = false; | |
this.faceLen = this.face.length / 2; | |
this.eyeLen = this.eyes.length / 2; | |
this.mouthLen = this.mouth.length; | |
this.blahLen = this.blah.length; | |
this.lhandLen = this.lhand.length; | |
this.rhandLen = this.rhand.length; | |
}; | |
Face.getRnd = function(l) | |
{ | |
return Math.floor(Math.random() * l); | |
} | |
Face.makeFace = function() | |
{ | |
this.noInit && this.init(); | |
var rObj, rLen; | |
// face | |
rObj = Math.random(); | |
rLen = this.getRnd(this.faceLen) * 2; | |
var _left_face = rObj < this.faceRnd ? this.face[rLen] : ''; | |
var _right_face = rObj < this.faceRnd ? this.face[rLen + 1] : ''; | |
// eyes | |
rLen = this.getRnd(this.eyeLen) * 2; | |
var _left_eye = this.eyes[rLen]; | |
var _right_eye = this.eyes[rLen + 1]; | |
// mouth | |
rObj = Math.random(); | |
rLen = this.getRnd(this.mouthLen); | |
var _mouth = rObj < this.mouthRnd ? this.mouth[rLen] : ''; | |
// blah | |
rObj = Math.random(); | |
rLen = this.getRnd(this.blahLen); | |
var _blah = rObj < this.blahRnd ? this.blah[rLen] : ''; | |
// left hand | |
rObj = Math.random(); | |
rLen = this.getRnd(this.lhandLen); | |
var _lhand = rObj < this.lhandRnd ? this.lhand[rLen] : ''; | |
// right hand | |
rObj = Math.random(); | |
rLen = this.getRnd(this.rhandLen); | |
var _rhand = rObj < this.rhandRnd ? this.rhand[rLen] : ''; | |
return [_lhand, _left_face, _left_eye, _mouth, _right_eye, _blah, _right_face, _rhand].join(''); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment