Question: Dr Racket: I'm confused on what to do on this assignment, Here's what it says: Rewrite last week's animate / big-bang of your own animation

Dr Racket:

I'm confused on what to do on this assignment, Here's what it says:

Rewrite last week's animate / big-bang of your own animation exercise to use posn.

Hint: Rewrite the x and y functions as one function position-at-time that returns a posn with both x and y in it.

and here's my code:

(define UFO (underlay/align "center" "center" (underlay/offset (circle 10 "solid" "gray") 0 -10 (underlay/offset (rectangle 10 8 "solid" "white") -30 0 (rectangle 10 8 "solid" "white"))) (rectangle 40 8 "solid" "white"))) (check-expect (real-x->screen-x -1) 0) (check-expect (real-x->screen-x 0) 250) (check-expect (real-x->screen-x 1) 500) (define (real-x->screen-x real-x) (+ (* real-x 250) 250))

(check-expect (real-y->screen-y 1) 0) (check-expect (real-y->screen-y 0) 250) (check-expect (real-y->screen-y -1) 500) (define (real-y->screen-y real-y) (- 500 (+ (* real-y 250) 250)))

(define curve 50) (define (x t) (cos (/ t curve))) (define (y t) (sin (/ t curve))) (define (create-UFO-scene t) (underlay/xy background (real-x->screen-x (x t)) (real-y->screen-y (y t)) UFO)) (animate create-UFO-scene)

Thanks for your help

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!