private IEnumerator resetZoom() { var controlSize = control.Size; var screenSize = control.GetManager().GetScreenSize(); var animatedSize = new dfAnimatedVector2(control.Size, controlSize, 0.2f); if (controlSize.x >= screenSize.x - 10 || controlSize.y >= screenSize.y - 10) { animatedSize.EndValue = fitImage(screenSize.x * 0.75f, screenSize.y * 0.75f, control.Width, control.Height); } else { animatedSize.EndValue = fitImage(screenSize.x, screenSize.y, control.Width, control.Height); } var endPosition = new Vector3(screenSize.x - animatedSize.EndValue.x, screenSize.y - animatedSize.EndValue.y, 0) * 0.5f; var animatedPosition = new dfAnimatedVector3(control.RelativePosition, endPosition, animatedSize.Length); var animatedRotation = new dfAnimatedQuaternion(control.transform.rotation, Quaternion.identity, animatedSize.Length); while (!animatedSize.IsDone) { control.Size = animatedSize; control.RelativePosition = animatedPosition; control.transform.rotation = animatedRotation; yield return(null); } }
private IEnumerator resetZoom() { var controlSize = control.Size; var screenSize = control.GetManager().GetScreenSize(); var animatedSize = new dfAnimatedVector2( control.Size, controlSize, 0.2f ); if( controlSize.x >= screenSize.x - 10 || controlSize.y >= screenSize.y - 10 ) { animatedSize.EndValue = fitImage( screenSize.x * 0.75f, screenSize.y * 0.75f, control.Width, control.Height ); } else { animatedSize.EndValue = fitImage( screenSize.x, screenSize.y, control.Width, control.Height ); } var endPosition = new Vector3( screenSize.x - animatedSize.EndValue.x, screenSize.y - animatedSize.EndValue.y, 0 ) * 0.5f; var animatedPosition = new dfAnimatedVector3( control.RelativePosition, endPosition, animatedSize.Length ); var animatedRotation = new dfAnimatedQuaternion( control.transform.rotation, Quaternion.identity, animatedSize.Length ); while( !animatedSize.IsDone ) { control.Size = animatedSize; control.RelativePosition = animatedPosition; control.transform.rotation = animatedRotation; yield return null; } }