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

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

The same effect occurs in racket/share/pkgs/realm/chapter5/ufo-source.rkt.
When the state is increasing from 0, the image is not moving down the
screen. It stays in one place, but is initially clipped to 0 horizontal
lines. Then 1 line, then 2, and only when the state is 1/2 the image height
does it start moving down the screen.

Also, if I call (draw-a-ufo-onto-an-empty-scene 0) in the interactions
window, I once again get a different result: it renders the lower half of
the image. This is the same behavior I see with my code.

Maybe a platform issue? (version) reports 6.0. I'm running it on ubuntu.



On Sun, Oct 5, 2014 at 6:13 PM, Matthias Felleisen <matthias at ccs.neu.edu>
wrote:

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

Posted on the users mailing list.