- Home /
Old Cartoon Effects
Hello Everyone,
a few days ago I asked myself if it's possible to make the old cartoon flickering "effect" like in the black and white cartoon movies back in the 30s. But I have no clue how to make such a "flickering".
Does anyone know if it is possible? And if, can you describe how I can make those effects?
Thank you in advance.
So... basically a coroutine that periodically enables and disables a (black) Image component stretched over the whole screen?
That sounds ... interesting. How would I make this courotine? I also meant those flickering effects like those at the beginning of this cartoon: https://www.youtube.com/watch?v=lAkg-qd1Bhk (00:00 - 00:20) + the juddering camera. Thanks for your help.
using UnityEngine.UI;
public Image image;
public float flickerTime = 0.1f;
public void Start() {
StartCoroutine("Flicker");
}
private IEnumerator Flicker() {
while(true) {
yield return new WaitForSeconds(flickerTime) ;
image.enabled = !image.enabled;
}
}
Thank you for your help. I tried your code but it doesn't work. How can I get this code work or how should I "use" it? To which gameobject should it be added? Sorry for my questions but I'm new to coroutine and UI elements. Thank you in advance.
Here is the full script:
using UnityEngine;
using UnityEngine.UI;
public class FlickerScript : $$anonymous$$onoBehaviour {
public Image image;
public float flickerTime = 0.1f;
public void Start() {
StartCoroutine("Flicker");
}
private IEnumerator Flicker() {
while(true) {
yield return new WaitForSeconds(flickerTime) ;
image.enabled = !image.enabled;
}
}
}
You add that script to any gameobject, drag any gameobject which has an UI image component which in turn has a black texture into the image slot, and hit play.
I strongly suggest doing some basic Unity tutorials first, though.
Usually you want to do such things in a postprocessing step, if you're looking for a professional solution:
https://docs.unity3d.com/560/Documentation/$$anonymous$$anual/PostProcessingWritingEffects.html