IEnumerator Morph(GlyphMatch match) { //targetGlyphGraphic.color = new Color(1f, 1f, 1f, 1f); Clear(castedGlyphGraphic); Stroke[] strokes = null; /* * for (float t=0;t<1;t+=0.05f){ * match.SetLerpStrokes(t, ref strokes); * Set(targetGlyphGraphic,strokes); * yield return new WaitForSeconds(step); * } */ float t = 0f; while (t < 0.99f) { match.SetLerpStrokes(t, ref strokes); Set(targetGlyphGraphic, strokes); //targetGlyphGraphic.material.color = Color.Lerp(glyphColours["default"], color, t); t += (1 - t) * 0.1f; yield return(new WaitForSeconds(step)); } Set(targetGlyphGraphic, match.target); if (IsClear(currentStrokeGraphic) && IsClear(currentGlyphGraphic)) { Set(castedGlyphGraphic, match.source); } }
IEnumerator MorphStored(GlyphMatch match) { Clear(castedGlyphGraphic); Stroke[] strokes = null; /* * for (float t=0;t<1;t+=0.05f){ * match.SetLerpStrokes(t, ref strokes); * Set(targetGlyphGraphic,strokes); * yield return new WaitForSeconds(step); * } */ float t = 0f; while (t < 0.99f && !stopStoredMorph) { match.SetLerpStrokes(t, ref strokes); Set(storedGlyphGraphic, strokes); storedGlyph = strokes; t += (1 - t) * 0.1f; yield return(new WaitForSeconds(step)); } if (!stopStoredMorph) { Set(storedGlyphGraphic, match.target); } stopStoredMorph = false; }
IEnumerator Morph(GlyphMatch match) { Clear(castedGlyphGraphic); Stroke[] strokes = null; /* * for (float t=0;t<1;t+=0.05f){ * match.SetLerpStrokes(t, ref strokes); * Set(targetGlyphGraphic,strokes); * yield return new WaitForSeconds(step); * } */ float t = 0f; while (t < 0.99f) { match.SetLerpStrokes(t, ref strokes); Set(targetGlyphGraphic, strokes); t += (1 - t) * 0.1f; yield return(new WaitForSeconds(step)); } Set(targetGlyphGraphic, match.target); if (IsClear(currentStrokeGraphic) && IsClear(currentGlyphGraphic)) { Set(castedGlyphGraphic, match.source); } }
IEnumerator Morph(GlyphMatch match) { Stroke[] strokes = null; for (float time = 0; time < morphDuration; time += step) { float progress = time / morphDuration; float t = morph.Evaluate(progress); match.SetLerpStrokes(t, ref strokes); foreach (Stroke s in strokes) { float size = Mathf.Lerp(Mathf.Max(drawingBounds.height, drawingBounds.width), 1f, t); s.Scale(new Vector2(size, size)); s.Translate(Vector2.Lerp(drawingBounds.center, Vector2.zero, t)); } Set(targetGlyphGraphic, strokes); yield return(new WaitForSeconds(step)); } Set(targetGlyphGraphic, match.target); StartCoroutine(FadeOut(targetGlyphGraphic, Color.white)); }