CameraFade Based on iTween (CAMERA fades in and out) and itweencamerafade
I. Basic Introduction; II. Basic Attributes
Address: http://blog.csdn.net/dingkun520wy/article/details/50896420
I. Basic Introduction
CameraTexture: Creates a full-screen Texture2D file based on the color provided for CameraFade.
CameraFadeAdd: creates an object to simulate the fade-in and fade-out of a camera.
CameraFadeDepth: changes the fade-in and fade-out depth of the camera (the object is the returned object of CameraFadeAdd)
CameraFadeDestroy: Delete the fade-in and fade-out effect of the camera (the object is the returned object of CameraFadeAdd)
CameraFadeSwap: changes the fade-in and fade-out background image of the camera (the object is the returned object of CameraFadeAdd)
CameraFadeFrom: changes the transparency of the fade-in and fade-out immediately and then returns the result over time. (The Fade-in and fade-out operations can only be performed on the CameraFadeAdd premise .) This method fades out from the objects returned by CameraFadeAdd to the original interface.
CameraFadeTo: changes the fade-in and fade-out transparency of the camera over time. (The Fade-in and fade-out operations can only be performed on the premise of CameraFadeAdd .) This method fades in from this interface to the object returned by CameraFadeAdd
Ii. Basic Attributes
Basic Attributes are relatively simple and code-oriented.
[Csharp]View plain copy
- Void Start (){
- // Specifies the camera background color.
- Texture2D texture = iTween. CameraTexture (new Color (0, 0, 0 ));
- // Initialize the mask and pass in the background and depth
- // ITween. CameraFadeAdd (texture, 99999 );
- ITween. CameraFadeAdd ();
- // Key-value pairs Save the parameters used by iTween
- Hashtable args = new Hashtable ();
- // The transparency of a fade-in or fade-out operation.
- Args. Add ("amount", 100 );
- // Overall animation time
- Args. Add ("time", 10f );
- // Delayed execution time
- Args. Add ("delay", 3f );
- // Here is the setting type, and there are many iTween types. In the source code, enumerate EaseType.
- // For example, the special effect of moving, first shaking in the movement, first moving back in the movement, first accelerating in the speed change, and so on
- Args. Add ("easeType", iTween. EaseType. easeInQuad );
- // None loop pingPong (General loop back and forth)
- // Args. Add ("loopType", "none ");
- // Args. Add ("loopType", "loop ");
- Args. Add ("loopType", iTween. LoopType. loop );
- // Process events in the animation process.
- // Call the AnimationStart method when starting the animation. 5.0 indicates its parameter.
- Args. Add ("onstart", "AnimationStart ");
- Args. Add ("onstartparams", 5.0f );
- // Set the object that accepts the method. The default value is "accept by yourself". You can change it to another object to accept it,
- // You must implement the AnimationStart method in the script of the receiving object.
- Args. Add ("onstarttarget", gameObject );
- // Call when the animation ends. The parameters are similar to those above.
- Args. Add ("oncomplete", "AnimationEnd ");
- Args. Add ("oncompleteparams", "end ");
- Args. Add ("oncompletetarget", gameObject );
- // Called in the animation. The parameters are similar to those above.
- Args. Add ("onupdate", "AnimationUpdate ");
- Args. Add ("onupdatetarget", gameObject );
- Args. Add ("onupdateparams", true );
- ITween. CameraFadeTo (args );
- // Specifies the camera background color.
- Texture2D texture2 = iTween. CameraTexture (new Color (0,100, 0 ));
- // Change the background color
- ITween. CameraFadeSwap (texture2 );
- // Change the depth
- ITween. CameraFadeDepth (999 );
- // Delete an animation
- // ITween. CameraFadeDestroy ();
- }
- // Called when the animation starts
- Void AnimationStart (float f)
- {
- Debug. Log ("start:" + f );
- }
- // Call when the animation ends
- Void AnimationEnd (string f)
- {
- Debug. Log ("end:" + f );
- }
- // Call in animation
- Void AnimationUpdate (bool f)
- {
- Debug. Log ("update:" + f );
- }