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

From: Brian Craft (bcboy at thecraftstudio.com)
Date: Mon Oct 6 12:04:19 EDT 2014

With 'record?' I don't see this in the gif, but do see it on-screen, which
is curious. Maybe a hardware acceleration bug? Also don't see it if I
render the scene in the interactions window. I only see it when running
with big-bang.

If I change the initial state to 100 I don't see this. It only happens on
low y value.

On Mon, Oct 6, 2014 at 8:52 AM, Spencer florence <spencerflorence at gmail.com>
wrote:

> huh, I’m unable to reproduce this as well.
>
> Brian, if you use the `record?` clause in big-bang do you see the same
> behavior in the generated gif? [ add (record? "/tmp”) to the big-bang
> expression, similar to what Matthias did in his example ]
>
> Also do you see the same behavior if you change the initial state to be
> 100?
>
> —Spencer
>
>
>
> On Mon, Oct 6, 2014 at 10:05 AM, Brian Craft <bcboy at thecraftstudio.com>
> wrote:
>
>>  If I record to a gif the effect isn't in the gif, though it does happen
>> on-screen while it is recording the gif. Here's a video, using a camera
>> phone. Sorry for the poor quality.
>>
>>
>> https://drive.google.com/file/d/0BxB9fW-JZz-ST3dfeFNxakRhMnRzcGtPQUtuaWJxMVRQTEFz/view
>>
>> Pause it around the 1 sec mark.
>>
>> On Mon, Oct 6, 2014 at 7:10 AM, Matthias Felleisen <matthias at ccs.neu.edu>
>> wrote:
>>
>>>
>>> Sorry, I don't understand what you mean. I have modified the main
>>> function so that (1) the whole thing is slower and (2) it records the whole
>>> thing as an animated gif:
>>>
>>> (define (main)
>>>   (big-bang 0                                        ;; initial state
>>>             (record? #t)                             ;; <---------------
>>>             (on-tick add-3-to-state 1/10)            ;; when the clock
>>> ticks, add ...   <-------------
>>>             (to-draw draw-a-ufo-onto-an-empty-scene) ;; when the state
>>> changes, draw ...
>>>             (stop-when state-is-300)))               ;; when the UFO's y
>>> coordinate is 300, stop.
>>>
>>>
>>>
>>> The animated gif is here:
>>>
>>>  http://www.ccs.neu.edu/home/matthias/Tmp/UFO/i-animated.gif
>>>
>>> -- Matthias
>>>
>>>
>>>
>>> On Oct 5, 2014, at 11:52 PM, Brian Craft <bcboy at thecraftstudio.com>
>>> wrote:
>>>
>>> > 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/20141006/5f8c4b14/attachment.html>

Posted on the users mailing list.