Page 1 of 1
Jerky Animated Graphics
Posted: Mon Mar 21, 2016 8:16 pm
by richmond62
I have been messing around with what are, frankly, extremely simplistic, experiments in animating
polygon graphics.
However, as I change the vertices of a graphic the thing won't stay still but keeps moving its centre, so I have
to keep reseting its left side. As a result while the animation is running the whole thing looks like
a horrible, jerky film from about 1880, which, while charming in its own way is not what I am
aiming at: a smooth, flowing animation.

- Graphic Games1.png (10.62 KiB) Viewed 4963 times
I would be most grateful for any ideas on how to achieve that smoothness of motion.
Re: Jerky Animated Graphics
Posted: Mon Mar 21, 2016 11:19 pm
by [-hh]
Code: Select all
on mouseUp
setPoints 2
end mouseUp
on setPoints STRETCH
lock screen; lock messages
put fld "VERTS" into fld "VERTS2"
put fld "VERTS" into fld "VERTS3"
add 2 to STRETCH; if STRETCH > 300 then exit setPoints
put (360 + STRETCH),310 into line 3 of fld "VERTS2"
put (360 - STRETCH),10 into line 4 of fld "VERTS2"
----
put (360 - STRETCH),310 into line 3 of fld "VERTS3"
put (360 + STRETCH),10 into line 2 of fld "VERTS3"
put (360 + STRETCH),10 into line 4 of fld "VERTS3"
set points of graphic "GG" to fld "VERTS2"
set points of graphic "GG2" to fld "VERTS3"
send "setPoints STRETCH" to me in 1 tick
unlock screen; unlock messages
end setPoints
I also would do that with variables, avoiding field reading/writing (and use one single polygon with 8 points).
Hermann
[Edit. Sorry, 8 points not 6 points. What I meant is the following.]
Code: Select all
local pts, dx
on mouseUp
put 2 into dx
put (50,10)&cr&(50,310)&cr&(360,310)&cr&(360,10) &cr&cr& \
(50,10)&cr&(360,10)&cr&(360,310)&cr&(50,310) into pts
setPoints 0
end mouseUp
on setPoints cntr
add 1 to cntr
if cntr > 310 div dx then exit setPoints
lock screen; lock messages
add dx to item 1 of line 3 of pts
add -dx to item 1 of line 4 of pts
add dx to item 1 of line 7 of pts
add -dx to item 1 of line 8 of pts
set points of graphic "GG" to pts
-- this is now so fast than you can go up here to 3 ticks
-- or use a slider for speed and/or dx, could be fun for kids?
send "setPoints cntr" to me in 1 ticks
unlock screen; unlock messages
end setPoints
Re: Jerky Animated Graphics
Posted: Tue Mar 22, 2016 12:42 am
by Simon
Sorry

- Just too easy
- BEEF-JERKY.gif (209.84 KiB) Viewed 4916 times
Simon
Re: Jerky Animated Graphics
Posted: Tue Mar 22, 2016 7:19 am
by richmond62
That was going pastrami so fast I almost missed it!