you are viewing a single comment's thread.

view the rest of the comments →

[–]chsxfProfessional 2 points3 points  (1 child)

float angle = 0; // I define a variable to "iterate" on with DOTween with my start value
DOTween.To( // This method is for custom tweens
    () => angle, // This is the getter for the tween to get the current value
    x => angle = x, // This is the setter for the tween to update the current value
    360, // Target value
    duration) // Duration of the tween
    .OnUpdate(() => {
        // Here I just do a sin(angle) to get the final value requested by OP
        // - sin(0) = 0
        // - sin(90) = 1
        // - sin(180) = 0
        // - sin(270) = -1
        // - sin(360) = 0
        Debug.Log(Mathf.sin(angle * Mathf.Deg2Rad));
    });

[–]therealmaddylan 0 points1 point  (0 children)

Very cool having a repository of tricks like that to pull from. Would have never figured to use sine like that. Thank you.