/////////////////////////////////////////////텍스트 생성 관련/////////////////////////////////////////////
function ffcreateText (contents, textType){
var textArray = new Array();
if (textType == "word") {
textArray=contents.split(" ")
} else if (textType == "char") {
textArray=contents.split("")
while(true){
var search = textArray.indexOf(" ");
if(search!=-1){
textArray.splice(search,1);
}else{
break;
}
console.log("gere"+textArray[0]+textArray[1]+textArray[2]);
}
} else if (textType == "line") {
textArray=[contents];
}
console.log("textArray "+textArray.length);
return textArray;
}
/////////////////////////////////////////////폰트 속성 관련/////////////////////////////////////////////
function ffSetFontAttr(target, options) {
options = options || {};
var defaults = {
fontFamily: "맑은 고딕",
fontSize : 60,
fontOpacity : 1,
fontRotation : 0,
fontStyle: "normal",
fontWeight: "normal"
};
for ( var prop in defaults) {
options[prop] = typeof options[prop] !== 'undefined' ? options[prop]
: defaults[prop];
}
target.style.color = options.fontColor;
target.style.fontSize = options.fontSize + 'px';
target.style.opacity = options.fontOpacity;
target.style.fontFamily = options.fontFamily;
target.style.fontStyle = options.fontStyle;
target.style.fontWeight = options.fontWeight;
target.style.textShadow = "-" + options.fontOutlineWidth + "px " + "0 " + options.textSpreadWidth + "px " + options.fontOutlineColor + ", " + "0 " + options.fontOutlineWidth + "px " + options.textSpreadWidth + "px " + options.fontOutlineColor + ", " + options.fontOutlineWidth + "px " + "0 " + options.textSpreadWidth + "px " + options.fontOutlineColor + ", " + "0 " + "-" + options.fontOutlineWidth + "px " + options.textSpreadWidth + "px " + options.fontOutlineColor;
};
/////////////////////////////////////////////텍스트 속성 관련/////////////////////////////////////////////
function ffSetTextAttr(target, options) {
options = options || {};
var defaults = {
initX : 0,
initY : 0,
textDecoration: "none",
letterSpacing: 0,
wordSpacing : 5,
lineHeight: 10,
textAlign: "center"
};
for ( var prop in defaults) {
options[prop] = typeof options[prop] !== 'undefined' ? options[prop]
: defaults[prop];
}
target.style.display = 'inline-block';
target.style.top = options.initY + "px";
target.style.left = options.initX + 'px';
target.style.textDecoration = options.textDecoration;
target.style.textShadow = options.textShadowWidth + "px " + options.textShadowWidth + "px " + options.textShadowColor;
target.style.letterSpacing = options.letterSpacing + "px";
target.style.wordSpacing = options.wordSpacing + "px";
target.style.lineHeight = options.lineHeight + "px";
target.style.textAlign = options.textAlign;
};