Merge pull request #75 from cewert/screensaver

Added screensaver
This commit is contained in:
Joshua M. Boniface 2019-10-06 14:52:18 -04:00 committed by GitHub
commit 43469647fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,11 @@
function init()
' backgroundUri must be set to an empty string before backgroundColor can be set
m.top.backgroundUri = ""
m.top.backgroundColor = &h000000
m.PosterOne = m.top.findNode("PosterOne")
m.PosterOne.uri = "pkg:/images/logo.png"
m.BounceAnimation = m.top.findNode("BounceAnimation")
m.BounceAnimation.control = "start" 'Start BounceAnimation
end function

View File

@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<component name="Screensaver" extends="Scene">
<script type="text/brightscript" uri = "Screensaver.brs"/>
<children>
<!-- Makes 2 Posters on top of each other -->
<Poster
id = "PosterOne"
width = "389"
height = "104"
opacity = "1"
translation = "[960,540]"
/>
<!--Gigantic loop for bouncing animation -->
<SequentialAnimation
id = "BounceAnimation"
repeat = "true"
>
<Animation
id = "AnimOne"
repeat = "false"
easeFunction = "linear"
duration = "7.2"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[960,540],[1500,250]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimTwo"
repeat = "false"
easeFunction = "linear"
duration = "4.5"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[1500,250],[1350,60]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimThree"
repeat = "false"
easeFunction = "linear"
duration = "16"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[1350,60],[200,890]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimFour"
repeat = "false"
easeFunction = "linear"
duration = "3.2"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[200,890],[30,750]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimFive"
repeat = "false"
easeFunction = "linear"
duration = "13.3"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[30,750],[1200,60]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimSix"
repeat = "false"
easeFunction = "linear"
duration = "6.7"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[1200,60],[1500,300]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimSeven"
repeat = "false"
easeFunction = "linear"
duration = "15"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[1500,300],[150,935]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimEight"
repeat = "false"
easeFunction = "linear"
duration = "2"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[150,935],[10,899.3]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
<Animation
id = "AnimNine"
repeat = "false"
easeFunction = "linear"
duration = "11"
>
<Vector2DFieldInterpolator
id = "OneInterp"
key = "[0.0,1.0]"
keyValue = "[[10,899.3],[960,540]]"
fieldToInterp = "PosterOne.translation"
/>
</Animation>
</SequentialAnimation>
</children>
</component>

View File

@ -45,3 +45,24 @@ sub LoginFlow()
goto start_login
end if
end sub
sub RunScreenSaver()
print "Starting screensaver..."
screen = createObject("roSGScreen")
m.port = createObject("roMessagePort")
screen.setMessagePort(m.port)
scene = screen.createScene("Screensaver")
screen.Show()
while(true)
msg = wait(8000, m.port)
if (msg <> invalid)
msgType = type(msg)
if msgType = "roSGScreenEvent"
if msg.isScreenClosed() then return
end if
end if
end while
end sub