-
Notifications
You must be signed in to change notification settings - Fork 715
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
App that shows tv static and a channel number in the top right corner (…
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 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,8 @@ | ||
--- | ||
id: tv-static | ||
name: TV Static | ||
summary: Show static on an old TV | ||
desc: Make your Tidbyt look like it is showing static on an old TV that is turned to Channel 3. | ||
author: Snuckey | ||
fileName: tv_static.star | ||
packageName: tvstatic |
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,59 @@ | ||
""" | ||
Applet: TV Static | ||
Summary: Show static on an old TV | ||
Description: Make your Tidbyt look like it is showing static on an old TV that is turned to Channel 3. | ||
Author: Snuckey | ||
""" | ||
|
||
load("random.star", "random") | ||
load("render.star", "render") | ||
|
||
STATIC_DIM = 2 | ||
|
||
def main(): | ||
return render.Root( | ||
child = render.Stack( | ||
children = [ | ||
render.Animation( | ||
children = staticFrames(), | ||
), | ||
render.Row( | ||
children = [ | ||
render.Text(content = "03", color = "#00ff00", font = "10x20"), | ||
], | ||
main_align = "end", | ||
expanded = True, | ||
), | ||
], | ||
), | ||
) | ||
|
||
def staticFrames(): | ||
frames = [] | ||
for _ in range(200): | ||
frames.append(staticScreen()) | ||
return frames | ||
|
||
def staticScreen(): | ||
static = [] | ||
|
||
for _ in range(int(32 / STATIC_DIM)): | ||
static.append(render.Row(children = staticRow())) | ||
|
||
return render.Column(children = static) | ||
|
||
def staticRow(): | ||
static = [] | ||
color = "" | ||
|
||
for _ in range(int(64 / STATIC_DIM)): | ||
num = random.number(0, 2) | ||
|
||
if num == 0: | ||
color = "#000000" | ||
else: | ||
color = "#ffffff" | ||
|
||
static.append(render.Box(width = STATIC_DIM, height = STATIC_DIM, color = color)) | ||
|
||
return static |