Unity3D 画面扭曲切换效果脚本
DreamWipe.js
1.
var camera1 : Camera;
2.var camera2 : Camera;
3.var fadeTime = 4.0;
4.var waveScale = .07; // Higher numbers make the effect more exaggerated. Can be negative, .5/-.5 is the max
5.var waveFrequency = 25.0; // Higher numbers make more waves in the effect
6.private var inProgress = false;
7.private var swap = false;
8.
9.function Start () {
10. ScreenWipe.use.InitializeDreamWipe();
11.}
12.function Update () {
13. if (Input.GetKeyDown("space")) {
14. DoFade();
15. }
16.}
17.function DoFade () {
18. if (inProgress) return;
19. inProgress = true;
20.
21. swap = !swap;
22. yield ScreenWipe.use.DreamWipe (swap? camera1 : camera2, swap? camera2 : camera1, fadeTime, waveScale, waveFrequency);
23.
24. inProgress = false;
25.}
1