{import * from CURL.GUI.SHAPES}
{value
let start:DateTime = {DateTime}
let img:ImageShape =
{ImageShape
fixed-transformation? = false,
{Pixmap.from-url
{url "../../default/images/curllogo.gif"}
}
}
let rect:RectangleShape =
{RectangleShape
{GRect 1cm, 1cm, 1.25cm, 1.25cm},
color = FillPattern.aqua,
translation = {Distance2d 3cm, 3cm},
img
}
let tmr:Timer =
{rect.animate
frequency=30fps, || 30 frames per second
repeat = 0,
{on TimerEvent do
let elapsed:Time = {start.elapsed}
{rect.set-rotation elapsed * (20deg / 1s)}
}
}
let run-button:CommandButton =
{CommandButton label = "Start",
{on Action do
set start = {DateTime}
set tmr.repeat = 500
}
}
let stop-button:CommandButton =
{CommandButton label = "Stop",
{on Action do
set tmr.repeat = 0
}
}
let can:Canvas =
{Canvas
width = 6cm,
height = 6cm,
border-width = 1px,
rect
}
{HBox
spacing = .125cm,
valign = "top",
{VBox
spacing = .125cm,
run-button,
stop-button
},
can
}
}
| |