I THINK I AM REALLY NOT A GOOD DESIGNER
I AM NOT PROFESSIONAL ENOUGH
I SOMEHOW CAN'T DISTINGUISH TO MYSELF THAT
I AM WORKING OR PLAYING
BE A DESIGNER, MUST BE A PRO ONE
WHILE I AM STILL FAR WAY TO GO TO THAT PHASE
BUT ONE THING FOR SURE.
I REALLY LIKE CODING. EVEN IT IS BAD CODES, IRVING.
stop();
//
function init_xml(XMLpath) {
content_XML = new XML();
content_XML.ignoreWhite = true;
content_XML.onLoad = function(success) {
if (success) {
//trace(content_XML);
stageAnimation.play();
}
};
content_XML.load(XMLpath);
}
function init_garden() {
totalPlant = content_XML.childNodes[0].childNodes.length;
plantScaleMax = 200;
plantScaleMin = 0;
plantX = 400;
plantY = 500;
for (k=0; k<totalPlant; k++) {
//create A plant
// plantObj = gardenMC.createEmptyMovieClip("plant"+k, k);
plantObj = gardenMC.attachMovie("plant", "plant"+k, k);
plantObj._y = plantY;
plantObj._x = plantX;
//
plantObj.stemHeight = (random(100)+100);
plantObj.xShift = random(300)*(random(2)*2-1);
plantObj.stemMC._height = plantObj.stemHeight-plantObj.rootMC._height;
plantObj.stemMC._y = -1*plantObj.rootMC._height;
plantObj.rootMC._x = plantObj.stemMC._x=plantObj.leaveMC0._x=plantObj.leaveMC1._x=plantObj.xShift;
plantObj.leaveMC0._y = (random(plantObj.stemHeight)+plantObj.rootMC._height)*-1;
plantObj.leaveMC1._y = (random(plantObj.stemHeight)+plantObj.rootMC._height)*-1;
plantObj.leaveMC0._rotation = -1*(random(30)+21);
plantObj.leaveMC1._rotation = (random(30)+21);
//
plantObj.totalWord = String(content_XML.childNodes[0].childNodes[k].childNodes[0]).length;
plantObj.wordSpace = 15;
plantObj.angleCenter = 90;
plantObj.angleOffset = 270;
plantObj.angleRange = 25;
plantObj.angleCount = random(plantObj.angleRange)*(random(2)*2-1);
//
plantObj.flip = "";
plantObj.angleInc = (random(10)+1)/10*(random(2)*2-1);
//
// txt array conversion
var lyricString = String(content_XML.childNodes[0].childNodes[k].childNodes[0]);
var lyricArray = lyricString.split("");
//
for (i=0; i<plantObj.totalWord; i++) {
wordObj = plantObj.attachMovie("dot", "dot"+i, i);
// the word / letter insertion
wordObj.txtObj.text = lyricArray[i];
//
var ratio = (plantObj.totalWord-i)/plantObj.totalWord;
var tmpRad = (plantObj.angleCount*ratio+plantObj.angleOffset)/180*Math.PI;
//
wordObj._y = Math.sin(tmpRad)*(plantObj.totalWord-i)*plantObj.wordSpace-plantObj.stemHeight;
wordObj._x = Math.cos(tmpRad)*(plantObj.totalWord-i)*plantObj.wordSpace+plantObj.xShift;
//
var ratioNext = (plantObj.totalWord-i+1)/plantObj.totalWord;
var tmpRadNext = (plantObj.angleCount*ratioNext+plantObj.angleOffset)/180*Math.PI;
currentY = wordObj._y;
currentX = wordObj._x;
nextY = Math.sin(tmpRadNext)*(plantObj.totalWord-i+1)*plantObj.wordSpace-plantObj.stemHeight;
nextX = Math.cos(tmpRadNext)*(plantObj.totalWord-i+1)*plantObj.wordSpace+plantObj.xShift;
//
wordObj._rotation = (Math.atan2(currentY-nextY, currentX-nextX)-Math.PI/2)*180/Math.PI;
}
//
plantObj._xscale = plantObj._yscale=((k+1)/totalPlant)*plantScaleMax;
}
// character setup
figureEman._y = figureEllen._y=plantY;
figureEman.gotoAndStop("idle");
figureEllen.gotoAndStop("idle");
//
butZoomIn.onPress = function() {
figureEman.gotoAndStop("walkFront");
figureEllen.gotoAndStop("walkFront");
zoom(-1);
changeTime("day");
};
butZoomIn.onRelease = function() {
figureEman.gotoAndStop("idleFront");
figureEllen.gotoAndStop("idleFront");
quitZoom();
};
butZoomIn.onRollOver = function() {
inOutGraphic.gotoAndStop(2);
};
butZoomIn.onRollOut = function() {
inOutGraphic.gotoAndStop(1);
};
//
butZoomOut.onPress = function() {
figureEman.gotoAndStop("walkBack");
figureEllen.gotoAndStop("walkBack");
zoom(+1);
//
changeTime("night");
};
butZoomOut.onRelease = function() {
figureEman.gotoAndStop("idleBack");
figureEllen.gotoAndStop("idleBack");
quitZoom();
};
butZoomOut.onRollOver = function() {
inOutGraphic.gotoAndStop(3);
};
butZoomOut.onRollOut = function() {
inOutGraphic.gotoAndStop(1);
};
}
//
function flipPlant(plantName) {
tmpPlantObj = gardenMC[plantName];
tmpPlantObj.onEnterFrame = function() {
for (i=0; i<this.totalWord; i++) {
var ratio = (this.totalWord-i)/this.totalWord;
var tmpRad = (this.angleCount*ratio+this.angleOffset)/180*Math.PI;
//
wordObj = this["dot"+i];
wordObj._y = Math.sin(tmpRad)*(this.totalWord-i)*this.wordSpace-this.stemHeight;
wordObj._x = Math.cos(tmpRad)*(this.totalWord-i)*this.wordSpace+this.xShift;
//
var ratioNext = (this.totalWord-i+1)/this.totalWord;
var tmpRadNext = (this.angleCount*ratioNext+this.angleOffset)/180*Math.PI;
currentY = wordObj._y;
currentX = wordObj._x;
nextY = Math.sin(tmpRadNext)*(this.totalWord-i+1)*this.wordSpace-this.stemHeight;
nextX = Math.cos(tmpRadNext)*(this.totalWord-i+1)*this.wordSpace+this.xShift;
//
wordObj._rotation = (Math.atan2(currentY-nextY, currentX-nextX)-Math.PI/2)*180/Math.PI;
}
//
this.angleCount += this.angleInc;
//trace("angleCount: "+this.angleCount);
//
if (this.angleCount>=this.angleRange || this.angleCount<=-1*this.angleRange) {
this.angleInc *= -1;
}
};
tmpPlantObj.flip = "enable";
}
function fadeFlipPlant(plantName) {
tmpPlantObj = gardenMC[plantName];
if (tmpPlantObj.flip == "enable") {
tmpPlantObj.damping = tmpPlantObj.angleInc;
tmpPlantObj.onEnterFrame = function() {
for (i=0; i<this.totalWord; i++) {
var ratio = (this.totalWord-i)/this.totalWord;
var tmpRad = (this.angleCount*ratio+this.angleOffset)/180*Math.PI;
//
wordObj = this["dot"+i];
wordObj._y = Math.sin(tmpRad)*(this.totalWord-i)*this.wordSpace-this.stemHeight;
wordObj._x = Math.cos(tmpRad)*(this.totalWord-i)*this.wordSpace+this.xShift;
//
var ratioNext = (this.totalWord-i+1)/this.totalWord;
var tmpRadNext = (this.angleCount*ratioNext+this.angleOffset)/180*Math.PI;
currentY = wordObj._y;
currentX = wordObj._x;
nextY = Math.sin(tmpRadNext)*(this.totalWord-i+1)*this.wordSpace-this.stemHeight;
nextX = Math.cos(tmpRadNext)*(this.totalWord-i+1)*this.wordSpace+this.xShift;
//
wordObj._rotation = (Math.atan2(currentY-nextY, currentX-nextX)-Math.PI/2)*180/Math.PI;
}
//
this.angleCount += this.damping;
//trace("this.damping: "+this.damping);
//
this.damping *= .9;
if (Math.abs(this.damping)<=.02) {
// trace("endLoop");
this.flip = "";
delete this.onEnterFrame;
}
//
if (this.angleCount>=this.angleRange || this.angleCount<=-1*this.angleRange) {
this.angleInc *= -1;
}
};
}
}
//
function zoom(zoomFactor) {
gardenMC.onEnterFrame = function() {
for (k=0; k<totalPlant; k++) {
plantObj = this["plant"+k];
plantObj._xscale = plantObj._yscale += zoomFactor;
if (plantObj._xscale>plantScaleMax) {
plantObj._xscale = plantObj._yscale -= plantScaleMax;
} else if (plantObj._xscale<plantScaleMin) {
plantObj._xscale = plantObj._yscale += plantScaleMax;
}
//
if (plantObj._xscale>plantScaleMax-10 && plantObj._xscale<=plantScaleMax) {
plantObj._alpha = (plantScaleMax-plantObj._xscale)*10;
} else {
plantObj._alpha = 100;
}
}
};
}
function quitZoom() {
delete gardenMC.onEnterFrame;
}
//
gardenMC.onMouseMove = function() {
for (k=0; k<totalPlant; k++) {
plantObj = this["plant"+k];
//
if (plantObj.hitTest(_root._xmouse, _root._ymouse, false)) {
flipPlant(plantObj._name);
//trace("hitter");
} else {
fadeFlipPlant(plantObj._name);
//trace("outter");
}
}
};
//
init_xml("garden.xml");
//
//
//
function initSOUND() {
dayMusicObj = new Sound();
dayMusicObj.attachSound("musicDay");
dayMusicObj.setVolume(0);
dayMusicObj.start(0,1000);
nightMusicObj = new Sound();
nightMusicObj.attachSound("musicNight");
nightMusicObj.setVolume(0);
nightMusicObj.start(0,1000);
}
function changeTime(timeCode) {
MusicObj.stop();
//
alphaRate = 4;
vol = 0;
if (timeCode == "day") {
bgColorCode = 0xFFFFFF;
logoColorCode = 0x000000;
//
MusicObj = new Sound();
MusicObj.attachSound("musicDay");
MusicObj.setVolume(100);
} else if (timeCode == "night") {
bgColorCode = 0x000000;
logoColorCode = 0xFFFFFF;
//
MusicObj = new Sound();
MusicObj.attachSound("musicNight");
}
MusicObj.setVolume(0);
MusicObj.start(0,1000);
//
//
//
backgroundMC.onEnterFrame = function() {
this._alpha -= alphaRate;
//
if (this._alpha<=0) {
backgroundColorObj = new Color(this);
backgroundColorObj.setRGB(bgColorCode);
//
this.onEnterFrame = function() {
this._alpha += alphaRate;
MusicObj.setVolume(this._alpha);
if (this._alpha>=100) {
this._alpha = 100;
MusicObj.setVolume(this._alpha);
delete this.onEnterFrame;
}
};
}
};
//
stageAnimation.logoMC.onEnterFrame = function() {
this._alpha -= alphaRate;
if (this._alpha<=0) {
logoColorObj = new Color(this);
logoColorObj.setRGB(logoColorCode);
//
this.onEnterFrame = function() {
this._alpha += alphaRate;
if (this._alpha>=100) {
this._alpha = 100;
delete this.onEnterFrame;
}
};
}
};
//
}
//
//initSOUND();
