Question by
karpenkoivan · Sep 14, 2016 at 12:52 PM ·
animationimageanimationcurvefill
Can`t animation fillAmount via script(C#)
void drawDiagramm(GameObject obj, double dem, double rep)
{
Animation anim = diagramm.GetComponent<Animation>();
AnimationClip clipOn = anim.GetClip("diagrammAlphaOn");
float keyDem = (float)(dem / 100);
float keyRep = (float)(rep / 100);
AnimationCurve animDem = new AnimationCurve();
AnimationCurve animRep = new AnimationCurve();
animDem.AddKey(0.0F, 0);
animRep.AddKey(0.0F, 0);
animDem.AddKey(keyDem, keyDem);
animRep.AddKey(keyRep, keyRep);
clipOn.SetCurve("demDiag", typeof(Image.fillAmount), "fillAmount", animDem);
clipOn.SetCurve("repDiagg", typeof(Image.fillAmount), "fillAmount", animRep);
}
But: UnityEngine.UI.Image.fillAmount' is a
property access' but a `type' was expected
Can you help me? How can I animate circle diagramm via script?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612092807im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Updating position with animation simultaneously 0 Answers
Making a classic animation style 0 Answers
How to fill a circle image by every second 1 Answer
Animation in script looking jittery? 0 Answers