-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrossFadeElement.sj
43 lines (34 loc) · 926 Bytes
/
crossFadeElement.sj
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
crossFadeElement #element (
fromElement : 'heap #element
toElement : 'heap #element
_rect := rect()
_fromEffect : fadeEffect()
getSize(maxSize : 'size) {
maxSize
}
getRect()'rect { _rect }
setRect(rect_ : 'rect) {
_rect = rect_
_fromEffect.setRect(_rect, parent.setRectInner)
toElement.setRect(_rect)
void
}
setRectInner(innerRect : 'rect) {
fromElement.setRect(innerRect)
}
setAmount(amount : 'f32) {
_fromEffect.alpha = 1.0f - amount
void
}
render(scene : 'scene2d) {
toElement.render(scene)
_fromEffect.render(scene, parent.renderInner)
}
renderInner(scene : 'scene2d) {
fromElement.render(scene)
}
fireMouseEvent(mouseEvent : 'mouseEvent) {
fromElement.fireMouseEvent(mouseEvent)
toElement.fireMouseEvent(mouseEvent)
}
) { this }