animations work now

This commit is contained in:
Linus Vogel 2025-12-01 22:29:27 +01:00
parent 6168798d19
commit eb6547eb1a
8 changed files with 64 additions and 30 deletions

View File

@ -0,0 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="logging.Logger.trace" />
</list>
</option>
</inspection_tool>
</profile>
</component>

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

6
.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

28
.idea/workspace.xml generated
View File

@ -5,8 +5,10 @@
</component>
<component name="ChangeListManager">
<list default="true" id="ae2847d5-ce86-4d84-8e66-f1369f1438e2" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/uv.lock" beforeDir="false" afterPath="$PROJECT_DIR$/uv.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/starsky_presenter/entry.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/starsky_presenter/entry.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/starsky_presenter/projection/screen.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/starsky_presenter/projection/screen.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/starsky_presenter/resources/scenes.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/starsky_presenter/resources/scenes.yml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -31,18 +33,18 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;restructuring&quot;,
&quot;last_opened_file_path&quot;: &quot;/home/linus/Desktop/HomeLabProjects/StarSkyPresenter/src/starsky_presenter/main.py&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;uv run.StarSky Presenter.executor&quot;: &quot;Run&quot;
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ModuleVcsDetector.initialDetectionPerformed": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.TerminalTabsStorage.copyFrom.TerminalArrangementManager": "true",
"RunOnceActivity.git.unshallow": "true",
"git-widget-placeholder": "main",
"last_opened_file_path": "/home/linus/Desktop/HomeLabProjects/StarSkyPresenter/src/starsky_presenter/main.py",
"settings.editor.selected.configurable": "preferences.pluginManager",
"uv run.StarSky Presenter.executor": "Run"
}
}</component>
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/resources" />

View File

@ -17,6 +17,10 @@ import pygame
from starsky_presenter.controller.window import ControlWindow
from starsky_presenter.projection.screen import Screen, Star
def dict_update(d1: dict, d2: dict) -> dict:
out = deepcopy(d1)
out.update(d2)
return out
def cli_main():
seed(43)
@ -25,18 +29,17 @@ def cli_main():
scenes = yaml.safe_load(reader.open_resource('resources/scenes.yml'))
objects = yaml.safe_load(reader.open_resource('resources/objects.yml'))
print(json.dumps(objects, indent=4))
print(objects['stars'][0]['sid'])
scene_data = [
{ obj['sid']: deepcopy(obj).update(scene[obj['sid']]) if scene and obj['sid'] in scene else deepcopy(obj) for obj in objects["stars"] }
for scene in scenes
scene_data = [{ obj['sid']: deepcopy(obj) for obj in objects["stars"] }] + [
{ obj['sid']: dict_update(obj, scenes[i][obj['sid']]) if scenes[i] and obj['sid'] in scenes[i] else deepcopy(obj) for obj in objects["stars"] }
if i < len(scenes) else { obj['sid']: deepcopy(obj) for obj in objects["stars"] }
for i in range(0,8)
]
star_references = {}
print(json.dumps(scenes, indent=4))
print(json.dumps(objects, indent=4))
print(json.dumps(scene_data, indent=4))
def setup_star_instance(data: dict) -> Star:
image_path = f"resources/{data['image']}"

View File

@ -1,3 +1,5 @@
import json
import pygame
from pygame import transform, gfxdraw, Vector2
from math import sin, cos, pi
@ -40,10 +42,14 @@ class Screen:
weight = sin(min(self.scene_time, pi/2)) ** 2
def update_star_scene(star, old, new, weight):
star.x = weight*new['x'] + (1-weight)*old['x']
star.x = weight*new[star.sid]['x'] + (1-weight)*old[star.sid]['x']
star.y = weight*new[star.sid]['y'] + (1-weight)*old[star.sid]['y']
star.rot = weight*new[star.sid]['rot'] + (1-weight)*old[star.sid]['rot']
star.scale = weight*new[star.sid]['scale'] + (1-weight)*old[star.sid]['scale']
for star in self.stars:
update_star_scene(star, scene_data[self.last_scene], scene_data[self.active_scene], weight)
star.alpha += star.rot * delta
scaled = transform.rotozoom(star.image, star.alpha, star.scale)
(w, h) = scaled.get_size()

View File

@ -37,7 +37,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 1"
onClicked: controller_backend.select_scene(1)
onClicked: controller_backend.select_scene(0)
}
Button {
@ -46,7 +46,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 2"
onClicked: controller_backend.select_scene(2)
onClicked: controller_backend.select_scene(1)
}
Button {
@ -55,7 +55,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 3"
onClicked: controller_backend.select_scene(3)
onClicked: controller_backend.select_scene(2)
}
Button {
@ -64,7 +64,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 4"
onClicked: controller_backend.select_scene(4)
onClicked: controller_backend.select_scene(3)
}
Button {
@ -73,7 +73,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 5"
onClicked: controller_backend.select_scene(5)
onClicked: controller_backend.select_scene(4)
}
Button {
@ -82,7 +82,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 6"
onClicked: controller_backend.select_scene(6)
onClicked: controller_backend.select_scene(5)
}
Button {
@ -91,7 +91,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 7"
onClicked: controller_backend.select_scene(7)
onClicked: controller_backend.select_scene(6)
}
Button {
@ -100,7 +100,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 8"
onClicked: controller_backend.select_scene(8)
onClicked: controller_backend.select_scene(7)
}
Button {
@ -109,7 +109,7 @@ ApplicationWindow {
width: parent.width * 0.1
height: parent.height * 0.1
text: "Scene 9"
onClicked: controller_backend.select_scene(9)
onClicked: controller_backend.select_scene(8)
}
}

View File

@ -1,4 +1,3 @@
-
- star-bg-01:
x: 0.6
star-bg-02: