- Home /
smooth scailing (gui title image)
rect coordinates from the center of the image grew so small, I would like to.
What grew from the center of the image was reduced to be able to do?
Gently increase the size of the image requires the use of scripts, which were smaller.
void Start () {
StartCoroutine(TitleCiAni());
}
void OnGUI(){
TitleUi();
}
void TitleUi(){
if(TitleCiBg)
{
Rect rcDraw = new Rect( (Screen.width - 1202f*fScale)/2, 35f*hScale,
593f*nWidth*fScale, 255f*nHeight*hScale );
GUI.DrawTextureWithTexCoords( rcDraw, uiTexture2, new Rect( 260.0f/1024.0f,
1.0f - (0.0f+255.0f)/1024.0f, 593.0f/1024.0f, 255.0f/1024.0f ) );
}
}
IEnumerator TitleCiAni()
{
if(Application.loadedLevelName == "Title")
{
TitleCiBg = true;
if(TitleCiBg)
{
yield return new WaitForSeconds(0.5f);
TitleCi = true;
}
float timer = 0f;
float endTimer = 0f;
while(endTimer < 2f)
{
while(timer < 1f)
{
nWidth += Time.smoothDeltaTime*0.2f;
nHeight += Time.smoothDeltaTime*0.2f;
timer += Time.smoothDeltaTime;
yield return null;
}
while(timer > 1f){
nWidth -= 1*Time.smoothDeltaTime;
nHeight -= 1*Time.smoothDeltaTime;
timer -= Time.smoothDeltaTime;
yield return null;
}
endTimer += timer;
timer = 0;
//nWidth = 1;
//nHeight = 1;
endTimer = 0;
yield return null;
}
}
}
Comment