Example #1
0
 public void SetWeight(float value)
 {
     if (fader == null)
     {
         var that = this;
         fader           = new CrossFadingFloat();
         fader.onChange += (v) =>
         {
             that.weight = v;
         };
     }
     fader.Value = value;
 }
Example #2
0
        public Finger(PlayableGraph graph, AnimationClip closed, AnimationClip opened, AvatarMask mask)
        {
            mixer = AnimationLayerMixerPlayable.Create(graph, 2);
            var openPlayable = AnimationClipPlayable.Create(graph, opened);

            graph.Connect(openPlayable, 0, mixer, 0);
            var closedPlayable = AnimationClipPlayable.Create(graph, closed);

            graph.Connect(closedPlayable, 0, mixer, 1);
            mixer.SetLayerAdditive(0, false);
            mixer.SetLayerMaskFromAvatarMask(0, mask);
            mixer.SetInputWeight(0, 1);
            mixer.SetInputWeight(1, 0);
            crossFadingWeight           = new CrossFadingFloat();
            crossFadingWeight.onChange += (value) =>
            {
                mixer.SetInputWeight(0, 1 - value);
                mixer.SetInputWeight(1, value);
            };
        }