Created
April 25, 2020 06:07
-
-
Save daichi-takezawa/897d3b62a019e181df98bac7fc0e9bd0 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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class TextScaleDownOrUp : MonoBehaviour | |
{ | |
public float time, changeSpeed; | |
public bool enlarge; | |
void Start() | |
{ | |
enlarge = true; | |
} | |
void Update() | |
{ | |
changeSpeed = Time.deltaTime * 0.1f; | |
if (time < 0) | |
{ | |
enlarge = true; | |
} | |
if (time > 0.7f) | |
{ | |
enlarge = false; | |
} | |
if (enlarge == true) | |
{ | |
time += Time.deltaTime; | |
transform.localScale += new Vector3(changeSpeed, changeSpeed, changeSpeed); | |
} | |
else | |
{ | |
time -= Time.deltaTime; | |
transform.localScale -= new Vector3(changeSpeed, changeSpeed, changeSpeed); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment