Esempio n. 1
0
    public void SeqInsert(ref Sequence seq, RadialWipeData wipe, float nextRotation)
    {
        seq.Insert(wipe.StartTime, DOTween.To(() => wipe.Img.fillAmount,
                                              x => wipe.Img.fillAmount = x, wipe.PercentageFinal * 0.01f, SliceWipeDuration).
                   SetEase(wipe.EaseType)
                   );
        seq.Insert(wipe.StartTime,
                   wipe.Img.transform.DORotate(wipe.EndRotation, SliceWipeDuration, RotateMode.FastBeyond360)
                   .SetEase(wipe.EaseType));

        // Rotate Dotted-Line to the avg angle between current and previous slices
        var dottedLineRot = Mathf.Lerp(wipe.EndRotation.z, nextRotation, 0.5f);

        //var dataTextTransf = wipe.DataText.Root.transform;
        seq.Insert(wipe.StartTime,
                   wipe.DottedLine.transform.DORotate(new Vector3(0, 0, dottedLineRot),
                                                      SliceWipeDuration, RotateMode.FastBeyond360)
                   .SetEase(wipe.EaseType));

        int count = 0;

        seq.Insert(wipe.StartTime,
                   DOTween.To(() => count, x => count = x, wipe.PercentageFinal,
                              SliceWipeDuration * 1.5f)
                   .SetEase(wipe.EaseType)
                   .OnUpdate(() => wipe.DataText.Value.text = count + "%")
                   );
    }
	public void SeqInsert (ref Sequence seq, RadialWipeData wipe, float nextRotation) {
		seq.Insert(wipe.StartTime, DOTween.To(() => wipe.Img.fillAmount,
			x => wipe.Img.fillAmount = x, wipe.PercentageFinal*0.01f, SliceWipeDuration).
			SetEase(wipe.EaseType)
			);
		seq.Insert(wipe.StartTime,
			wipe.Img.transform.DORotate (wipe.EndRotation, SliceWipeDuration, RotateMode.FastBeyond360)
			.SetEase (wipe.EaseType));

		// Rotate Dotted-Line to the avg angle between current and previous slices
		var dottedLineRot = Mathf.Lerp(wipe.EndRotation.z, nextRotation, 0.5f);
		//var dataTextTransf = wipe.DataText.Root.transform;
		seq.Insert (wipe.StartTime,
			wipe.DottedLine.transform.DORotate (new Vector3 (0, 0, dottedLineRot), 
			SliceWipeDuration, RotateMode.FastBeyond360)
			.SetEase(wipe.EaseType));

		int count = 0;
		seq.Insert(wipe.StartTime,
			DOTween.To(() => count, x => count = x, wipe.PercentageFinal,
						SliceWipeDuration * 1.5f)
						.SetEase(wipe.EaseType)
						.OnUpdate(()=>wipe.DataText.Value.text = count+"%")
					);
	}
Esempio n. 3
0
    public float SetupSlice(int idx, int acumulatedPercent, float prevRotation)
    {
        RadialWipeData thisWipe = DonutSlices[idx];

        thisWipe.StartTime       = Parser.Slices.Slices[idx].StartTime;
        thisWipe.EaseType        = Parser.Slices.Slices[idx].EaseType.ToEaseType();
        thisWipe.PercentageFinal = Parser.Slices.Slices[idx].FinalPercent;

        float thisRotation = 359.0f - (360.0f * (acumulatedPercent / 100.0f));

        thisWipe.EndRotation.z = thisRotation;

        return(thisRotation);
    }
Esempio n. 4
0
    private void SetSlicesFill(Sequence mySeq)
    {
        for (int i = 0; i < DonutSlices.Length; i++)
        {
            RadialWipeData wipe = DonutSlices[i];
            wipe.DataText.Value.text           = "0%";
            wipe.Img.transform.rotation        = Quaternion.Euler(0f, 0f, -1);
            wipe.DottedLine.transform.rotation = Quaternion.Euler(0f, 0f, -1);
            wipe.Img.fillAmount = 0.03f;
            var nextRotation = (i + 1 < DonutSlices.Length)
                                ? DonutSlices[i + 1].EndRotation.z
                                : 0.5f;
            if (mySeq != null)
            {
                SeqInsert(ref mySeq, wipe, nextRotation);
            }
            // Places the DataText root
//			var dataTextTransf = wipe.DataText.Root.transform;
//			dataTextTransf.position = wipe.DottedLine.EndRef.position;
        }
    }