I’m working on building a simple cardboard app that uses images inside bubbles at the bottom to navigate between spaces. My question is, what are some recommended or best approaches for doing this?
My preferred visual effect would be each scene situated in a bubble, and once the the bubble is gazed at, it visually fills or changes color for a specified period of time before changing to the next scene.
I understand how to implement the gaze, my question revolves more around the visual look of the “bubble”. I’ve experimented with an image inside a sphere, and using color lerping to fill the bubble before it changes. The one problem is, I haven’t found a good shader that keeps the image viewable at the end of the lerping. Is this the best way to achieve the desired effect or should I explore another method?
Code is below. I’m using spacebar currently as test until I get the desired effect.
using UnityEngine;
using System.Collections;
public class Fill : MonoBehaviour {
float lerpTime = 5f;
float currentLerpTime;
Color startColor = Color.clear;
Color endColor = Color.green;
protected void Start() {
startColor = Color.clear;
endColor = Color.green;
}
protected void Update() {
//reset when we press spacebar
if (Input.GetKeyDown(KeyCode.Space)) {
currentLerpTime = 0f;
}
//increment timer once per frame
currentLerpTime += Time.deltaTime;
if (currentLerpTime > lerpTime) {
currentLerpTime = lerpTime;
}
//lerp!
float perc = currentLerpTime / lerpTime;
GetComponent().material.color = Color.Lerp(startColor, endColor, perc);
}
}