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

From: Brian Craft (bcboy at thecraftstudio.com)
Date: Sun Oct 5 20:52:33 EDT 2014

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141005/c3b8dd06/attachment.html>

Posted on the users mailing list.