// Start is called before the first frame update void Start() { //ThumbWhite.SetActive(false); //ThumbBlur.SetActive(false); temp = ThumbWhite.GetComponent <Image>().color; temp.a = 0.0f; ThumbWhite.GetComponent <Image>().color = temp; }
// Update is called once per frame void Update() { temp = ThumbWhite.GetComponent <Image>().color; if (ispressed) { PressedTime += Time.deltaTime; temp.a = Mathf.Min(PressedTime / 2, 1.0f);//2 seconds until white //Debug.Log("changing alpha"); ThumbWhite.GetComponent <Image>().color = temp; } else if (temp.a > 0) { RefillTime -= Time.deltaTime; //Debug.Log(temp.a); //Debug.Log(Delay); temp.a = Mathf.Max(RefillTime / Delay, 0.0f); //Debug.Log(temp.a); ThumbWhite.GetComponent <Image>().color = temp; //Debug.Log(temp); } }
public void OnPointerUp(PointerEventData eventData) { ispressed = false; RefillTime = ThumbWhite.GetComponent <Image>().color.a *Delay; //Reset from previous a }
public void OnPointerDown(PointerEventData eventData) { ispressed = true; PressedTime = ThumbWhite.GetComponent <Image>().color.a * 2; }