I was on Leopard with the Shoes build from your blog _why, but the script is getting pretty big now so it's possible that something else is causing it to break. I'll try that sample tonight to test it out. Thanks for the suggestion about using a var inside the animate loop to check stuff, I'll see if I can use it. The reason why I had it in the keypress loop is that everything on the screen is going to be static, with the exception of a short period when the user presses a button. Since the whole thing doesn't need to be animated I just wanted to minimize the redrawing, and escape out of the keypress animate() with a return statement. -tieg
On Thu, Jun 26, 2008 at 10:10 AM, _why <[EMAIL PROTECTED]> wrote: > On Thu, Jun 26, 2008 at 12:51:08AM -0400, Tieg Zaharia wrote: > > I was wondering why it's not possible to call animate() inside a keypress > > event? All the typical Shoes shapes seem to work in one, but if you nest > an > > animate() loop in there it doesn't work. > > > > Is animate() mostly intended to encompass whole apps, or is it possible > to > > do little animate() parts only when we need them? > > What platform are you on? animate() should be okay in a keypress(). > > Here's an example that will move a circle when you press a key. And > then pause it the next time you press a key. > > Shoes.app do > background white > @circle = oval 0, 0, 100, 100 > > keypress do > if @anim > @anim.toggle > else > @anim = animate do |i| > @circle.move i, i > end > end > end > end > > One thing you have to remember about using `animate` in a keypress > or mouse event is that it'll create a new animation loop every time > the event goes off. Jenna's advice of starting the animation > outside the event is good. > > It's also possible that your keypress isn't going off due to a form > element. > > _why >
