-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto stash before merge of "main" and "origin/main"
- Loading branch information
Showing
4 changed files
with
120 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import "pkg:/source/utilities/utilities.bs" | ||
|
||
sub init() | ||
m.layer1 = m.top.findNode("layer1") | ||
m.layer2 = m.top.findNode("layer2") | ||
m.layer3 = m.top.findNode("layer3") | ||
end sub | ||
|
||
sub setCover() | ||
registerNewPoster(Rnd(15), 0) | ||
registerNewPoster(Rnd(15), 1) | ||
registerNewPoster(Rnd(15), 2) | ||
registerNewPoster(Rnd(15), 3) | ||
registerNewPoster(Rnd(15), 4) | ||
registerNewPoster(Rnd(15), 5) | ||
registerNewPoster(Rnd(15), 6) | ||
registerNewPoster(Rnd(15), 7) | ||
registerNewPoster(Rnd(15), 8) | ||
registerNewPoster(Rnd(15), 9) | ||
end sub | ||
|
||
sub registerNewPoster(delay, posterIndex) | ||
newPosterID = `newPoster${posterIndex}` | ||
posterNode = m.top.findNode(newPosterID) | ||
if isValid(posterNode) then return | ||
|
||
horizPosition = Rnd(1080) | ||
animationType = Rnd(4) | ||
|
||
if animationType = 1 | ||
size = "200" | ||
duration = 15 | ||
targetLayer = m.layer1 | ||
blendColor = "#FFFFFF" | ||
else if animationType = 2 | ||
size = "100" | ||
duration = 25 | ||
targetLayer = m.layer2 | ||
blendColor = "#AAAAAA" | ||
else | ||
size = "40" | ||
duration = 40 | ||
targetLayer = m.layer3 | ||
blendColor = "#555555" | ||
end if | ||
|
||
newPoster = createObject("roSGNode", "Poster") | ||
newPoster.id = `newPoster${posterIndex}` | ||
newPoster.blendColor = blendColor | ||
newPoster.width = size | ||
newPoster.height = size | ||
newPoster.uri = m.top.trackCover | ||
newPoster.translation = `[${horizPosition}, -200]` | ||
m.top.appendChild(newPoster) | ||
|
||
newAnimation = createObject("roSGNode", "Animation") | ||
newAnimation.duration = duration | ||
newAnimation.repeat = "false" | ||
newAnimation.easeFunction = "linear" | ||
newAnimation.delay = delay | ||
|
||
newVector2DFieldInterpolator = createObject("roSGNode", "Vector2DFieldInterpolator") | ||
newVector2DFieldInterpolator.key = "[0.0, 1.0]" | ||
newVector2DFieldInterpolator.keyValue = `[[${horizPosition}, -200], [${horizPosition}, 800]]` | ||
newVector2DFieldInterpolator.fieldToInterp = `newPoster${posterIndex}.translation` | ||
|
||
newAnimation.appendChild(newVector2DFieldInterpolator) | ||
newAnimation.observeFieldScoped("state", "onAnimationStateChange") | ||
targetLayer.appendChild(newAnimation) | ||
|
||
newAnimation.control = "start" | ||
end sub | ||
|
||
sub onAnimationStateChange(msg) | ||
animationNode = msg.getRoSGNode() | ||
if LCase(animationNode.state) = "stopped" | ||
posterID = animationNode.getChild(0).fieldToInterp.replace(".translation", "") | ||
posterIndex = Right(posterID, 1) | ||
posterNode = m.top.findNode(posterID) | ||
if isValid(posterNode) | ||
posterNode.getParent().removeChild(posterNode) | ||
registerNewPoster(Rnd(10), posterIndex) | ||
end if | ||
end if | ||
end sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<component name="ScreenSaver" extends="Group"> | ||
<children> | ||
<Rectangle | ||
color="0x000000FF" | ||
height="800" | ||
translation="[0,0]" | ||
width="1280" | ||
/> | ||
<Group id="layer3" /> | ||
<Group id="layer2" /> | ||
<Group id="layer1" /> | ||
</children> | ||
<interface> | ||
<field id="trackCover" type="string" onChange="setCover" /> | ||
</interface> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters