Demigiant / dotween

A Unity C# animation engine. HOTween v2
http://dotween.demigiant.com
Other
2.35k stars 350 forks source link

DOColor only works the first time #448

Closed darkblade60 closed 3 years ago

darkblade60 commented 3 years ago

Hi,

I have a button with this logic:

    public void showIngredients()
    {
        if (ingredients == true)
        {
            ingredients = false;
            imgCruzImg.DOColor(new Color(244, 253, 255), 0.5f);  // default color
            imgCruz.DORotate(new Vector3(0f, 0f, 0f), 0.5f);
        }
        else 
        {
            ingredients = true;
            imgCruzImg.DOColor(new Color(255, 0, 139), 0.5f);
            imgCruz.DORotate(new Vector3(0,0, 135f),0.5f);        
        } 
    }

No more logic in the button. First time it is working ok (gradual change to the new color), but later, the change is direct (with the delay of the duration).

Any ideas?

Ty!

darkblade60 commented 3 years ago

Wtf, If I use Color.white and Colors.red instead NEW COLOR it works fine.... I don't understand.

Demigiant commented 3 years ago

Ahoy! Unity Color has a range that goes from 0 to 1, not 0 to 255.