codeworld-api-0.5.0: Graphics library for CodeWorld

Safe HaskellNone
LanguageHaskell98

CodeWorld.Parameter

Description

Warning: This is an experimental API. It can change at any time.

Synopsis

Documentation

data Parameter Source #

The source for a parameter that can be adjusted in a parametric drawing. Parameters can get their values from sliders, buttons, counters, timers, etc.

parametricDrawingOf :: [Parameter] -> ([Double] -> Picture) -> IO () Source #

A drawing that depends on parameters. The first argument is a list of parameters. The second is a picture, which depends on the values of those parameters. Each number used to retrieve the picture is the value of the corresponding parameter in the first list.

slider :: Text -> Parameter Source #

A Parameter that can be adjusted continuously between 0 and 1.

toggle :: Text -> Parameter Source #

A Parameter that can be toggled between 0 (off) and 1 (on).

counter :: Text -> Parameter Source #

A Parameter that counts how many times it has been clicked.

constant :: Text -> Double -> Parameter Source #

A Parameter with a constant value, and no way to change it.

random :: Text -> Parameter Source #

A Parameter that has a randomly chosen value. It offers a button to regenerate its value.

timer :: Text -> Parameter Source #

A Parameter that changes over time. It can be paused or reset.

currentHour :: Parameter Source #

A Parameter that tracks the current hour, in local time. The hour is on a scale from 0 (meaning midnight) to 23 (meaning 11:00 pm).

currentMinute :: Parameter Source #

A Parameter that tracks the current minute, in local time. It ranges from 0 to 59.

currentSecond :: Parameter Source #

A Parameter that tracks the current second, in local time. It ranges from 0.0 up to (but not including) 60.0. This includes fractions of a second. If that's not what you want, you can use withConversion to truncate the number.

converted :: (Double -> Double) -> Parameter -> Parameter Source #

Adjusts the output of a parameter by passing it through a conversion function. Built-in parameters usually range from 0 to 1, and conversions can be used to rescale the output to a different range.

renamed :: Text -> Parameter -> Parameter Source #

Changes the name of an existing parameter.