This commit is contained in:
Brahim Hadriche committed 2023-12-08 06:50:57 -05:00
1 parent 665f76701d
commit 457242057d
3 files changed
+5 -4

No files matched your search

@@ -1,9 +1,7 @@
import "pkg:/source/utils/Types.bs"
function Init()
' TODO:P0 use component property with alias to fix crash
' TODO:P2 make component disposable, and stop animation when component is disposed
m.animation = m.top.findNode("loadingAnimation")
m.top.observeField("visible", FuncName(OnVisibleChanged))
OnVisibleChanged()
end function
@@ -13,10 +11,10 @@ function OnVisibleChanged()
end function
function OnIndexSet()
m.animation.delay = (m.top.index mod 5) * 0.2
m.top.animationDelay = (m.top.index mod 5) * 0.2
Animate()
end function
function Animate()
m.animation.control = m.top.visible ? "start" : "stop"
m.top.animationControl = m.top.visible ? "start" : "stop"
end function
@@ -3,6 +3,8 @@
<field id="itemContent" type="node" onChange="OnContentSet" />
<field id="index" type="integer" onChange="OnIndexSet" />
<field id="type" type="string" value="loading" />
<field id="animationDelay" type="time" alias="loadingAnimation.delay" />
<field id="animationControl" type="string" alias="loadingAnimation.control" />
</interface>
<children>
<Rectangle