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.
I would be most grateful for any ideas on how to achieve that smoothness of motion.
Jerky Animated Graphics
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Jerky Animated Graphics
- Attachments
-
- Graphic Games.livecode.zip
- Here's the stack.
- (2.18 KiB) Downloaded 263 times
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Jerky Animated Graphics
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
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
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Jerky Animated Graphics
Sorry
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Livecode Opensource Backer
- Posts: 9389
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Jerky Animated Graphics
That was going pastrami so fast I almost missed it!