Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Color change/transition animation

Discussion in 'Animation' started by AsadGIK, Jan 28, 2020.

  1. AsadGIK

    AsadGIK

    Joined:
    Jan 28, 2020
    Posts:
    2
    Hey I am new to using unity and I am using engine 2018.5f1. I want to know how would it be possible to make a simple colour transition from one color to another using a button that shows up on the screen.
    And if possible I want to know if there would be a way to make the color start from bottom then spread it up to the top

    Ps. Would it be possible to use mecanim?
    Thanks! Help would be greatly appreciated
     
  2. knobblez

    knobblez

    Joined:
    Nov 26, 2017
    Posts:
    223
  3. Olmi

    Olmi

    Joined:
    Nov 29, 2012
    Posts:
    1,553
    Hi @AsadGIK,

    Regarding your question about having color spread so that it starts from the bottom. Yes it's possible, but you need to probably create a shader that does it. Or find an existing shader. One way (although not perfect) is to use a gradient (grayscale) as the pattern, then you change the color using that gradient... Well, this is just a high level concept but it's quite simple to implement. There are other ways that you could do this, too.
     
  4. AsadGIK

    AsadGIK

    Joined:
    Jan 28, 2020
    Posts:
    2
    @Olmi hey,

    Thank you for your reply. Okay I will try both, starting with the easier one and I think that would be using shader, I guess. Can you provide me with a link that would help me get started with these two.

    @knobblez
    Thank you. Can lerping be used to start the color change from the bottom then travel upwards when I press a specific button or with a button that shows up on screen.
     
  5. knobblez

    knobblez

    Joined:
    Nov 26, 2017
    Posts:
    223
    Off the top of my head I'm not sure how to do that exactly but it seems like you're looking for something along the lines of this: