1
$\begingroup$

Can anybody help me with changing colors of a mesh in animation? When I change the color and set the keyframe, the last modified color of the mesh is applied on all previous keyframes. When I press i to set keyframe, which keyframe should I choose from the rolling list?

$\endgroup$
3
  • 1
    $\begingroup$ As with most properties in Blender, material colors can be animated. Just press I with your mouse hovering over the box. See blender.stackexchange.com/questions/1284/… and blender.stackexchange.com/questions/176/… $\endgroup$
    – Timaroberts
    Jan 11, 2018 at 22:25
  • $\begingroup$ Hello, I did it but obviously I am doing something wrong. I move cursor on the timeline, then I change color of the object and then I press "I". When I press "I", the rolling list pops up and there is a keyframe menu. Which keyframe should I choose? $\endgroup$
    – Silvia
    Jan 11, 2018 at 22:32
  • $\begingroup$ No, press "i" on the color pick box. nearly every property can be aninated like this! $\endgroup$
    – m.ardito
    Jan 11, 2018 at 22:40

3 Answers 3

6
$\begingroup$

You can key frame the actual color by just hitting "i" on the color box

enter image description here

Starts out blue - hit "i"

enter image description here

Move the timeline and box and change the color and hit "i" again.

enter image description here

$\endgroup$
0
0
$\begingroup$

You can change color by scripting in case you don't want to resort to rendering. You need to open your text editor and change your colors like so:

def f1(hodnota, what, materialA, materialB):
    if (hodnota < 0):
        bpy.data.scenes['Scene'].objects[what].material_slots[materialA].material.diffuse_color[2] = value*(-1)
        bpy.data.scenes['Scene'].objects[what].material_slots[materialA].material.diffuse_color[1] = 0
        bpy.data.scenes['Scene'].objects[what].material_slots[materialA].material.diffuse_color[0] = 0
    return value*value

bpy.app.driver_namespace['f1'] = f1

When you are happy with your function, click Run Script button in your text editor. To call the function select your driver object, go to Graph editor -> Drivers and into Expr field code something like

f1(var, 'Cylinder.002', 'Material.001', 'Material.002')

You will need to run the script each time you open your file and it is generally pain in the neck, but in case your computer is too weak to run rendered view or if you want to show what you see when developing, it is a way.

Animation

I didn't find a way to attach my blend file. Hopefully this will be enough to get you started or you will find a way to let me know how to attach it.

$\endgroup$
3
  • 1
    $\begingroup$ Not a very good advice. Why overcomplicate everything when such a simple functionality is needed? The question is clearly about keyframe animation. It's important to know what tools are best for the job. It is definitely not Python scripting in this case. $\endgroup$ Nov 3, 2018 at 13:00
  • $\begingroup$ Welcome to BSE. Upload to blend-exchange post the link to this question where asked. Note can pass self as a reference to the object being driven. IMO drivers are a valid answer to "Change colors during animation?" On closer investigation of question, OP is having trouble with basic key-framing, however demonstrating there is another approach cannot hurt. $\endgroup$
    – batFINGER
    Nov 3, 2018 at 13:49
  • $\begingroup$ It is the only way that worked for me and I thought it would be nice if I shared it in case somebody else needed it as well. $\endgroup$
    – Jan Kokes
    Nov 4, 2018 at 14:25
0
$\begingroup$

How to change colors during animation? with Blender Render.

enter image description here

enter image description here

Repeat steps for your next mesh/object. Thank you!

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .