sketching
sketching copied to clipboard
window resize
Hello great job but is there a way to calculate parametrically when the size of the canvas changes (window resize) my naive test and probably ugly code from Racket does this
thanks
sorry for my bad translation
Hi @nodrygo
I have added an event handler on-resize
that a user can define if he wants to know if the
window size changed. The system variables width
and height
are automatically
updated, so it might not be necessary to use on-resize
.
Remember to update sketching
before trying the program below.
#lang sketching
(define (setup)
(size 400 300))
(define (on-resize width height)
(displayln (list width height)))
(define (draw)
(rect (random width) (random height) 100 100))
great work fine thank's a lot