[racket] place-image winking effect with low y coord

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sun Oct 5 21:13:00 EDT 2014

Can you send the full program please? Thanks -- Matthias



On Oct 5, 2014, at 8:52 PM, Brian Craft wrote:

> Hello -- Newbie here. I'm going through "Realm of Racket". I'm seeing an odd effect when using this to-draw handler in big-bang:
> 
> (define (draw-a-ufo-onto-an-empty-scene game)
>   (let ([pos (game-pos game)])
>     (place-image IMAGE-of-UFO (round (vec-x pos)) (round (vec-y pos))
>                  (empty-scene WIDTH HEIGHT))))
> 
> vec is (struct vec (x y))
> 
> As the y coordinate approaches zero, IMAGE-of-UFO gets clipped on the top and bottom, looking a bit like it's winking out of existence, rather than sliding off the canvas. This doesn't happen on any other edge. It's only as y approaches zero. It starts when the edge of the image meets the edge of the scene. That is, if the image is 20px high, and y starts at 30, and decreases by 1 on each tick, it will move up the canvas for 30..10, but from 10 on the image will not change position, but will instead be clipped on the top & bottom, until it disappears.
> 
> This does not happen in the interactions window. If I call the above function in the interactions window, it renders as expected, with the image moving smoothly off the edge.
> 
> 
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.