CameraFade Based on iTween (CAMERA fades in and out) and itweencamerafade

Source: Internet
Author: User

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
  1. Void Start (){
  2. // Specifies the camera background color.
  3. Texture2D texture = iTween. CameraTexture (new Color (0, 0, 0 ));
  4. // Initialize the mask and pass in the background and depth
  5. // ITween. CameraFadeAdd (texture, 99999 );
  6. ITween. CameraFadeAdd ();
  7. // Key-value pairs Save the parameters used by iTween
  8. Hashtable args = new Hashtable ();
  9. // The transparency of a fade-in or fade-out operation.
  10. Args. Add ("amount", 100 );
  11. // Overall animation time
  12. Args. Add ("time", 10f );
  13. // Delayed execution time
  14. Args. Add ("delay", 3f );
  15. // Here is the setting type, and there are many iTween types. In the source code, enumerate EaseType.
  16. // 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
  17. Args. Add ("easeType", iTween. EaseType. easeInQuad );
  18. // None loop pingPong (General loop back and forth)
  19. // Args. Add ("loopType", "none ");
  20. // Args. Add ("loopType", "loop ");
  21. Args. Add ("loopType", iTween. LoopType. loop );
  22. // Process events in the animation process.
  23. // Call the AnimationStart method when starting the animation. 5.0 indicates its parameter.
  24. Args. Add ("onstart", "AnimationStart ");
  25. Args. Add ("onstartparams", 5.0f );
  26. // Set the object that accepts the method. The default value is "accept by yourself". You can change it to another object to accept it,
  27. // You must implement the AnimationStart method in the script of the receiving object.
  28. Args. Add ("onstarttarget", gameObject );
  29. // Call when the animation ends. The parameters are similar to those above.
  30. Args. Add ("oncomplete", "AnimationEnd ");
  31. Args. Add ("oncompleteparams", "end ");
  32. Args. Add ("oncompletetarget", gameObject );
  33. // Called in the animation. The parameters are similar to those above.
  34. Args. Add ("onupdate", "AnimationUpdate ");
  35. Args. Add ("onupdatetarget", gameObject );
  36. Args. Add ("onupdateparams", true );
  37. ITween. CameraFadeTo (args );
  38. // Specifies the camera background color.
  39. Texture2D texture2 = iTween. CameraTexture (new Color (0,100, 0 ));
  40. // Change the background color
  41. ITween. CameraFadeSwap (texture2 );
  42. // Change the depth
  43. ITween. CameraFadeDepth (999 );
  44. // Delete an animation
  45. // ITween. CameraFadeDestroy ();
  46. }
  47. // Called when the animation starts
  48. Void AnimationStart (float f)
  49. {
  50. Debug. Log ("start:" + f );
  51. }
  52. // Call when the animation ends
  53. Void AnimationEnd (string f)
  54. {
  55. Debug. Log ("end:" + f );
  56. }
  57. // Call in animation
  58. Void AnimationUpdate (bool f)
  59. {
  60. Debug. Log ("update:" + f );
  61. }


 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.