Skip to content

Instantly share code, notes, and snippets.

@daichi-takezawa
Created April 25, 2020 06:07
Show Gist options
  • Save daichi-takezawa/897d3b62a019e181df98bac7fc0e9bd0 to your computer and use it in GitHub Desktop.
Save daichi-takezawa/897d3b62a019e181df98bac7fc0e9bd0 to your computer and use it in GitHub Desktop.
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