Presentation Big Bang
The presentation big-bang system provides a magnified image and visual indications showing the location of the mouse, the last key or mouse event, and the passing of time. It is designed to be used in presentations or recordings to make it clear what actions are triggering the visual responses.
1 An Example
(require 2htdp/universe) (require presentation-big-bang) (define (dr n) (overlay (text (number->string n) 48 "black") (empty-scene 300 200))) (presentation-big-bang 10 (to-draw dr) (on-tick add1 1.0) (meta (magnification 3) (reset-tick 30) (reset-key "r")))
An example frame from a presentation big-bang:
.
2 Customizing the animation
The new "meta" block in the "presentation-big-bang" sets parameters used in the animation.
The "magnification" parameter controls the scale factor applied to the draw handler. The default magnification factor is 2.
The "reset-tick" parameter sets a value at which the entire model resets to its original state. By default this is 300.
The "reset-key" is a key (string) which resets the model to its original state when pressed. By default this key is "escape".
3 Metadata
Metadata tracks the time passing as well as the last event (keypress or mouse event). The default metadata display shows this information in the upper left and right of the screen.
3.1 Information available
The meta struct holds information about the animation. The fields are the x and y coordinates of the mouse, the last event (key press or mouse event), and the number of ticks since the animation started.
struct
(struct meta (x y event ticks) #:extra-constructor-name make-meta) x : number? y : number? event : string? ticks : number?
3.2 Customizing the metadata
Originally there was a "meta-draw" argument. That is no longer exposed, but it would be easy to add.
procedure
(meta-draw-h md img) → image?
md : meta? img : image?
3.3 All recognized options
Unrecognized options are passed directly to big-bang.
syntax
(presentation-big-bang INITIAL-MODEL (to-draw draw-handler [width height]) (on-tick tick-handler [delay [tick-count]]) (on-mouse mouse-handler) (on-key key-handler) (on-release key-handler) (on-pad pad-handler) (on-receive receive-handler) (check-with good-struct?) (stop-when should-stop? [last-scene-draw-handler]) (meta (magnification 3) (reset-tick 40) (reset-key "r")))