zadvorsky / three.bas

THREE.JS Buffer Animation System

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help

smilesheep opened this issue · comments

Hello~, I was your fan when I saw your project on CODEPEN,and I really like your project examples/timeline_1.
Here I have an idea that I want to change the material's color of the third row to green in your project examples/timeline_1. but my ability is limited and I have failed to change the color.
Can you help me achieve it? Thank you very much.

To change the colors of individual prefabs you can work with vertex colors, like here.

You also have to set vertexColors: THREE.VertexColors on the material, like here.

I have successfully changed it's color.
Thank you very much :-)
Can I change its color when it rotates instead of the initial state? Because that looks really cool.

You can animate color much like any other property, like rotation, position and scale. You can either create two vertex attributes (startColor & endColor), and mix between the two, or determine the color based on some other values, and set vColor.rgb in one of the vertex shader chunks.