waltheri / wgo.js

JavaScript library for game of Go.
http://wgo.waltheri.net/
305 stars 126 forks source link

Animation? #15

Closed neagle closed 10 years ago

neagle commented 10 years ago

Have you thought at all about adding animation to WGo?

None of the SGF Viewers I've seen have animation, but it adds a lot to the beauty of a player when it's added. (Here's a very simple example from a player I was working on a while ago.)

I hacked together a quick proof-of-concept on WGo over my lunch break, and I think making a more serious attempt to add animation to WGo wouldn't be too difficult. But I was curious whether this is something you'd already thought about and had any opinion on.

animation-poc

waltheri commented 10 years ago

Hi,

thanks for your idea. However I am not sure about this one - I prefer simplicity and I have feeling it could be disturbing for those, who wants to just replay a game. Moreover I think it would be difficult to implement with current WGo architecture.

Cheers, Jan

2014-05-28 20:29 GMT+02:00 Nate Eagle notifications@github.com:

Have you thought at all about adding animation to WGo?

None of the SGF Viewers I've seen have animation, but it adds a lot to the beauty of a player when it's added. (Here's a very simple examplehttp://gokibitz.com/demos/2014-05-02/from a player I was working on a while ago.)

I hacked together a quick proof-of-concept on WGo over my lunch break, and I think adding it to WGo wouldn't be too difficult. But I was curious whether this is something you'd already thought about and had any opinion on.

[image: animation-poc]https://cloud.githubusercontent.com/assets/176993/3109025/cc24dece-e695-11e3-905e-8420ef21cda9.gif

— Reply to this email directly or view it on GitHubhttps://github.com/waltheri/wgo.js/issues/15 .

neagle commented 10 years ago

I think it would always be accompanied by an option to disable it entirely (or, indeed, be disabled by default). And I don't think it'd be so difficult to work into WGo architecture - the way I did it in a very brief amount of time was just to use a self-calling setTimeout in the addObjects function that modified two new properties: mx and my (m for modify) that tweened either of those values from something to zero. Then I modified the draw functions for the stones and CR to add whatever the current value of mx or my was to the current coordinates. After that, it was as simple as setting a setInterval to call board.redraw 30 times a second.

That said, this is why I asked! If it's not something that interests you, I can very easily maintain it in my own fork. Thanks for weighing in!

waltheri commented 10 years ago

If you like this feature, you don't have to make it in your fork. It would be best, if you create a plugin - some javascript file that user could include into his HTML and this would turn on this animation. One of purposes of WGo is to be extensible, so I welcome any extension in my repository and site ;-)

2014-05-28 21:24 GMT+02:00 Nate Eagle notifications@github.com:

I think it would always be accompanied by an option to disable it entirely (or, indeed, disabled by default). And I don't think it'd be so difficult to work into WGo architecture - the way I did it in a very brief amount of time was just to use a self-calling setTimeout in the addObjects function that modified two new properties: mx and my (m for modify) that tweened either of those values from something to zero. Then I modified the draw functions for the stones and CR to add whatever the current value of mxor my was to the current coordinates. After that, it was as simple as setting a setInterval to call board.redraw 30 times a second.

That said, this is why I asked! If it's not something that interests you, I can very easily maintain it in my own fork. Thanks for weighing in!

— Reply to this email directly or view it on GitHubhttps://github.com/waltheri/wgo.js/issues/15#issuecomment-44452815 .

neagle commented 10 years ago

That's a great suggestion; I'll definitely go that route if it's possible. (It'll require some creativity to think about how I could layer on this functionality without modifying the core of WGo.js. But it's an interesting problem!)

Thanks, @waltheri!

waltheri commented 10 years ago

I want WGo to be extensible and I tried to design it that way, so if you wont be able to implement this plugin, I am willing to change the core to make it possible.

2014-05-29 16:07 GMT+02:00 Nate Eagle notifications@github.com:

That's a great suggestion; I'll definitely go that route if it's possible. (It'll require some creativity to think about how I could layer on this functionality without modifying the core of WGo.js. But it's an interesting problem!)

Thanks, @waltheri https://github.com/waltheri!

— Reply to this email directly or view it on GitHubhttps://github.com/waltheri/wgo.js/issues/15#issuecomment-44535095 .

neagle commented 10 years ago

I really appreciate that. I'll let you know how things are going whenever I start working on my plugin. Thanks again!