- Home /
iTween: How to animate other shader-color values besides the main Color?
Hi,
is it possible with iTween to tween other Shader-color values like "_SpecColor" or "_ReflectColor" or any custom shader values? The current tween parameters like "ColorFrom/ColorTo/ColorUpdate" only edit the MainColor..
For example i use Ani.Mate for tweening like this (but would love to use iTween only):
meshArray.renderer.sharedMaterial.SetColor("_SpecColor", Color.red);
Thanks for any help on that.
Answer by tiagomelobr · Aug 03, 2011 at 02:00 AM
I don't know if this is still needed, but I've searched in many places and didn't find an answer.
You need to change the iTweenScript to be able to handle this. Is a small change, just add "_TintColor" to the NamedValueColor enum. It should be like this:
public enum NamedValueColor{
/// <summary>
/// The main color of a material. Used by default and not required for Color methods to work in iTween.
/// </summary>
_Color,
/// <summary>
/// The specular color of a material (used in specular/glossy/vertexlit shaders).
/// </summary>
_SpecColor,
/// <summary>
/// The emissive color of a material (used in vertexlit shaders).
/// </summary>
_Emission,
/// <summary>
/// The reflection color of the material (used in reflective shaders).
/// </summary>
_ReflectColor,
_TintColor
}
After that, just use ColorTo normally:
iTween.ColorTo(gameObject,{"a": 0.3,"time":1,"namedcolorvalue": "_TintColor", "loopType":"pingPong", "easeType":"easeInOutQuad", "includeChildren":true});
I've forgot to remember you, you need to change "_TintColor" for whenever value you like!
Hey everyone, thanks in advance for all the help.
This seems to address exactly what I am having trouble with, the only issue is that I am using the iTween Visual Editor and am not able to use ColorTo as referenced above. Im not a programmer, so the Visual Editor has been great for creating all the animated color shifts, I just cant get it to change my particle colors.
Do you know how I can add _TintColor to the iTweenEvent script so that I can change the Tint Color of Particles using the iTween Visual Editor rather than calling it from a script? Ive been digging around in all the iTween scripts to no avail.
Thanks, Austinj
Thank you thank you thank you tiagomelobr. That's exactly what I needed (modifying the NamedValueColor enum).
Your answer
Follow this Question
Related Questions
Legacy animation system cannot animate colors? 3 Answers
iTween.ColorTo on one material 1 Answer
Move Towards Target Color 2 Answers
Custom Easing Types using Curves for Motion? 3 Answers
Set the procedural color texture script to a set pattern? 1 Answer