// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; namespace Microsoft.MixedReality.GraphicsTools.Samples.UnityUI { /// /// Example of how to use a CanvasMaterialAnimatorBase to animate properties via script. /// public class ScriptedMaterialAnimation : MonoBehaviour { public CanvasMaterialAnimatorGraphicsToolsStandardCanvas Animator; private void Start() { if (Animator == null) { Animator = GetComponent(); } } private void Update() { if (Animator != null) { Animator._VertexExtrusionValue = Mathf.Lerp(0, 0.002f, (Mathf.Sin(Mathf.Repeat(Time.time, Mathf.PI * 2.0f)) + 1.0f) * 0.5f); Animator.ApplyToMaterial(); } } } }