# Color cubes with e.g. a linear function?

Posted 4 years ago
3897 Views
|
2 Replies
|
1 Total Likes
|
 Dear Community,I've constructed a few cubes with indices from 1 to 9. (see Cubes.nb) I would like to color them with e.g. a linear function. Cube 1 should be e.g. blue, cube 9 e.g. red, and the remaining cubes should change color linearly between blue and red. How could I do it? I guess it has something to do with the ColorFunction but its not clear how to use it.Tx for the help in advance, best regards Andras Attachments:
2 Replies
Sort By:
Posted 4 years ago
 something like this cubes[[ic]] = {Hue[(3i+j)/10],Cuboid[ {i-0.5,j-0.5,1} , {i+0.5,j+0.5,2} ]} ; 
Posted 4 years ago
 Dear Frank,Perfect, thank you very much :-).Andras