51 lines
1.1 KiB
Text
51 lines
1.1 KiB
Text
|
|
-- DreamStack Streaming Mood
|
||
|
|
-- Interactive mood and energy tracker.
|
||
|
|
-- Only mood, energy, color are exposed (clicks is internal).
|
||
|
|
--
|
||
|
|
-- Run with:
|
||
|
|
-- dreamstack stream examples/streaming-mood.ds --port 3004 --relay ws://localhost:9100/source/mood
|
||
|
|
|
||
|
|
let mood = "neutral"
|
||
|
|
let energy = 50
|
||
|
|
let color = "gray"
|
||
|
|
let clicks = 0
|
||
|
|
|
||
|
|
stream mood_tracker on "ws://localhost:9100/peer/mood" {
|
||
|
|
mode: signal,
|
||
|
|
output: mood, energy, color
|
||
|
|
}
|
||
|
|
|
||
|
|
view mood_tracker =
|
||
|
|
column [
|
||
|
|
text "😊 Mood Tracker"
|
||
|
|
text "Mood: {mood}"
|
||
|
|
text "Energy: {energy}%"
|
||
|
|
text "Color: {color}"
|
||
|
|
row [
|
||
|
|
button "😄 Happy" {
|
||
|
|
click: mood = "happy"
|
||
|
|
click: color = "green"
|
||
|
|
click: energy = energy + 10
|
||
|
|
}
|
||
|
|
button "😐 Neutral" {
|
||
|
|
click: mood = "neutral"
|
||
|
|
click: color = "gray"
|
||
|
|
}
|
||
|
|
button "😤 Angry" {
|
||
|
|
click: mood = "angry"
|
||
|
|
click: color = "red"
|
||
|
|
click: energy = energy - 10
|
||
|
|
}
|
||
|
|
]
|
||
|
|
row [
|
||
|
|
button "☕ Caffeine" {
|
||
|
|
click: energy = energy + 25
|
||
|
|
click: clicks += 1
|
||
|
|
}
|
||
|
|
button "😴 Rest" {
|
||
|
|
click: energy = energy - 15
|
||
|
|
click: clicks += 1
|
||
|
|
}
|
||
|
|
]
|
||
|
|
]
|