forked from Syomus/ProceduralToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Transitions.cginc
68 lines (57 loc) · 1.89 KB
/
Transitions.cginc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef PROCEDURAL_TOOLKIT_TRANSITIONS_INCLUDED
#define PROCEDURAL_TOOLKIT_TRANSITIONS_INCLUDED
//
// Collection of transition animations
//
#include "SDF.cginc"
float HorizontalTransition01(float2 p, float time01)
{
float d = p.x - time01;
return InverseSmoothStep0(d)*RectangleStep(0.0, time01);
}
float HorizontalTransition010(float2 p, float time01)
{
float t1 = LineStep(0.0, 0.5, time01);
float t2 = LineStep(0.5, 1.0, time01);
float d = Difference(p.x - t1, p.x - t2);
return InverseSmoothStep0(d)*RectanglePulse(time01, 0.0, 1.0);
}
float VerticalTransition01(float2 p, float time01)
{
float d = p.y - time01;
return InverseSmoothStep0(d)*RectangleStep(0.0, time01);
}
float VerticalTransition010(float2 p, float time01)
{
float t1 = LineStep(0.0, 0.5, time01);
float t2 = LineStep(0.5, 1.0, time01);
float d = Difference(p.y - t1, p.y - t2);
return InverseSmoothStep0(d)*RectanglePulse(time01, 0.0, 1.0);
}
float RadialTransition01(float2 p, float time01)
{
float d = SpaceSegment(p, time01*UNITY_TWO_PI);
return InverseSmoothStep0(d)*RectangleStep(0.0, time01);
}
float RadialTransition010(float2 p, float time01)
{
float t1 = LineStep(0.0, 0.5, time01);
float t2 = LineStep(0.5, 1.0, time01);
float d = Difference(SpaceSegment(p, t1*UNITY_TWO_PI), SpaceSegment(p, t2*UNITY_TWO_PI));
return InverseSmoothStep0(d)*RectanglePulse(time01, 0.0, 1.0);
}
float CircleTransition01(float2 p, float time01)
{
const float radius = 1.5;
float d = Circle(p, time01*radius);
return InverseSmoothStep0(d)*RectangleStep(0.0, time01);
}
float CircleTransition010(float2 p, float time01)
{
float t1 = LineStep(0.0, 0.5, time01);
float t2 = LineStep(0.5, 1.0, time01);
const float radius = 1.5;
float d = Difference(Circle(p, t1*radius), Circle(p, t2*radius));
return InverseSmoothStep0(d)*RectanglePulse(time01, 0.0, 1.0);
}
#endif