Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
26
Task/Image-noise/Racket/image-noise.rkt
Normal file
26
Task/Image-noise/Racket/image-noise.rkt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#lang racket
|
||||
(require 2htdp/image 2htdp/universe)
|
||||
|
||||
(define black (color 0 0 0 255))
|
||||
(define white (color 255 255 255 255))
|
||||
|
||||
(define-struct world (last fps))
|
||||
|
||||
(define (noise w h)
|
||||
(color-list->bitmap
|
||||
(for*/list ([x (in-range w)] [y (in-range h)])
|
||||
(if (zero? (random 2)) black white))
|
||||
w h))
|
||||
|
||||
(define (draw w)
|
||||
(underlay/xy
|
||||
(noise 320 240) 0 0
|
||||
(text (number->string (world-fps w)) 64 "Red")))
|
||||
|
||||
(define (handle-tick w)
|
||||
(define cm (current-inexact-milliseconds))
|
||||
(make-world cm (exact-floor (/ 1000.0 (- cm (world-last w))))))
|
||||
|
||||
(big-bang (make-world 1 0)
|
||||
[on-draw draw]
|
||||
[on-tick handle-tick (/ 1. 120)])
|
||||
Loading…
Add table
Add a link
Reference in a new issue