dreamstack/examples/springs.ds

25 lines
569 B
Text
Raw Normal View History

-- DreamStack Springs + 2D Scene
-- Physics-driven rendering. No CSS for animation.
let ball_x = spring(200)
let ball_y = spring(150)
let sidebar_w = spring(240)
view main = column [
text "Spring Physics"
text ball_x
text ball_y
row [
button "Center" { click: ball_x = 200 }
button "Left" { click: ball_x = 50 }
button "Right" { click: ball_x = 350 }
button "Top" { click: ball_y = 50 }
button "Bottom" { click: ball_y = 300 }
]
text sidebar_w
button "Wide" { click: sidebar_w = 300 }
button "Narrow" { click: sidebar_w = 60 }
]