-
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.
- Loading branch information
1 parent
0e0298d
commit 09a0aae
Showing
3 changed files
with
90 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,49 @@ | ||
import app | ||
import math | ||
import time | ||
from events.input import Buttons, BUTTON_TYPES | ||
from app_components import clear_background | ||
|
||
class EMF_Spinner(app.App): | ||
def __init__(self): | ||
self.button_states = Buttons(self) | ||
self.x = -240 | ||
self.r = 0 | ||
|
||
def update(self, delta): | ||
if self.button_states.get(BUTTON_TYPES["CANCEL"]): | ||
self.button_states.clear() | ||
self.minimise() | ||
|
||
def draw(self, ctx): | ||
clear_background(ctx) | ||
ctx.save() | ||
# this seems very resource intensive - perhaps we can avoid redrawing with each rotation of the EMF logo? | ||
ctx.linear_gradient(-120,-120,240,240) | ||
if self.r in range(0,89): | ||
ctx.add_stop(0.0, (46,173,217), 1.0) | ||
ctx.add_stop(0.5, (249,226,0), 1.0) | ||
elif self.r in range(90,179): | ||
ctx.add_stop(0.0, (249,226,0), 1.0) | ||
ctx.add_stop(0.5, (246,127,2), 1.0) | ||
elif self.r in range(180,269): | ||
ctx.add_stop(0.0, (246,127,2), 1.0) | ||
ctx.add_stop(0.5, (245,80,137), 1.0) | ||
else: | ||
ctx.add_stop(0.0, (245,80,137), 1.0) | ||
ctx.add_stop(0.5, (46,173,217), 1.0) | ||
ctx.rectangle(-120, -120, 240, 240) | ||
ctx.fill() | ||
# yellow circle around the edge of the screen | ||
ctx.rgb(255,234,0).arc(0,0,120,0,2*math.pi, True).stroke() | ||
ctx.rotate((self.r*math.pi)/180) | ||
ctx.image("/apps/martin_hamilton_EMF_Spinner/emf2024-logo-dark-small.png",self.x,-120,133,235) | ||
self.r = self.r + 10 | ||
if (self.r > 360): | ||
self.r = 0 | ||
if (self.x < -70): | ||
self.x = self.x + 10 | ||
time.sleep(0.01) | ||
|
||
__app_export__ = EMF_Spinner | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,41 @@ | ||
[app] | ||
# The name of your app as displayed in the menu | ||
name = "EMF_Spinner" | ||
|
||
# The submenu where your app should appear. | ||
# One of: "Badge", "Music", "Media", "Apps", "Games" | ||
category = "Badge" | ||
|
||
# OPTIONAL: Same as above, for compatibility with older firmware | ||
# versions that can't handle categories introduced afterwards. | ||
# One of: "Badge", "Music", "Apps" | ||
# menu = "Badge" | ||
|
||
# OPTIONAL: If your app prefers wifi to be off or on when entering. | ||
# Useful if you want more resources (false) or need wifi (true). | ||
# Remove if you don't want to change wifi state! | ||
#wifi_preference = true | ||
|
||
[entry] | ||
# The name of your entry point `Application` class | ||
class = "EMF_Spinner" | ||
|
||
[metadata] | ||
# Your nickname. Must be at most 32 characters! | ||
author = "MartinH" | ||
|
||
# License of your app as an SPDX identifier: <https://spdx.org/licenses/> | ||
license = "LGPL-3.0-only" | ||
|
||
# URL to the repository of your app. | ||
url = "https://github.com/martin-hamilton/EMF-Spinner" | ||
|
||
# Description of your app. Maximum 140 characters! | ||
description = "Spinny EMF 2024 logo with trippy background colours" | ||
|
||
# Version number of your app. If you push a commit where this number is | ||
# increased, we interpret this as a new version being released. | ||
# | ||
# Version number must be an integer! | ||
version = "0.0.1" | ||
|