codeworld-api-0.6.0: Graphics library for CodeWorld

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.

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

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

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

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

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

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

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).

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

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.

Changes the name of an existing parameter.