Ugui Official example is the use of animation to control the movement of the UI, zoom out animation and so on, animation to control the UI animation is too much, so we generally use itween,dotween. To control the animation, so the workload is greatly reduced. Well, let's study Ugui + dotween today.
Ugui for simple movement, magnification, rotation
Public classMyclass:monobehaviour {voidStart () {image Image= transform. Getcomponent<image>(); //the coordinate system of the domove is the lower left corner, which moves to the 100,100 position.Image.rectTransform.DOMove (NewVector2 ( -, -), 1f); //moves to the current coordinate point x+100, current coordinates y+100Image.rectTransform.DOMove (NewVector2 (image.recttransform.position.x + -, IMAGE.RECTTRANSFORM.POSITION.Y + -), 1f); //current sacle (1,1,1) added to (3,3,1) within 1 secondsImage.rectTransform.DOBlendableScaleBy (NewVector2 (2,2), 1f); //rotate to 180 degreesImage.rectTransform.DORotate (NewVector3 (0,0, the), 1f); }}
Ugui anchor Point and anchoredposition relationship
The coordinates produced by x, Y, and ancharedposition relative to the anchor point. When the plate is writing a joystick UI, the joystick is only in the lower left corner, so the joystick is set to the bottom left, and I assign values to the joystick based on the location of the user tapping the screen input.mouseposition.x and INPUT.MOUSEPOSITION.Y anchoredposition So the function is displayed as normal. but once I was careful, I set the rocker's anchor point to the center of the screen, no matter how I clicked on the joystick in the right position (can you imagine this effect)
Ugui and Dotween for damage text effects
=.= Home in writing
Dotween Study Notes (ii) Ugui combined use