I just wondering is that also possible in LINQPad so that I can write a real-time 2D GAME in LINQPad by html canvas via getContext("2d") and then call requestAnimateFrame?
This isn't easy right now, unless you intend to do the whole thing inside the browser by emitting JavaScript.
To make it possible to interact with the canvas from a LINQPad script, I can create a Canvas HTML control easily enough in the next build. However, bear in mind that you won't get good performance because every call has to cross a process boundary, and the rendering engine is currently stuck at IE11.
The getContext method returns an object which must be proxied across the process boundary rather than being serialized. It's not hard for me to implement because I already have a remoting framework in LINQPad.
I've just uploaded a new beta with this capability. There are also new Canvas and Svg controls to make the process easier. Create a Canvas and Svg and press F1 on the type for a demo. Let me know how you get along.
But seems it's does not looks very handy, wondering is there any solution that I can convert the dynamic object into something like a interface that support intellisence in LINQPad?
Is there any reason that you don't want to use WPF for animation? It will be hundreds of times faster. All you need to do is create the WPF control and dump it.
Thanks, impromptu-interface is what I want here. I'm just curios, nothing serious here, just for fun . But if we really want to create a canvas toy, we need the requestAnimationFrame It's the key to new world.
I'm using SharpDX to do real-time rendering, and I created a nuget package(with linqpad-samples) here: FlysEngine and FlysEngine.Desktop, which based on SharpDX/Direct2D. Which can be downloaded here: https://www.nuget.org/packages?q=FlysEngine
Comments
To make it possible to interact with the canvas from a LINQPad script, I can create a Canvas HTML control easily enough in the next build. However, bear in mind that you won't get good performance because every call has to cross a process boundary, and the rendering engine is currently stuck at IE11.
IE 11 is not a issue here, it should supports HTML 5 canvas.
Although it may not get a great performance since cross-process communication, but I think it's a path to a new world.
The getContext method returns an object which must be proxied across the process boundary rather than being serialized. It's not hard for me to implement because I already have a remoting framework in LINQPad.
I've just uploaded a new beta with this capability. There are also new Canvas and Svg controls to make the process easier. Create a Canvas and Svg and press F1 on the type for a demo. Let me know how you get along.
requestAnimationFrame
Document here:
https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
That would be greatly benifit for me
https://github.com/ekonbenefits/impromptu-interface
Is there any reason that you don't want to use WPF for animation? It will be hundreds of times faster. All you need to do is create the WPF control and dump it.
impromptu-interface
is what I want here. I'm just curios, nothing serious here, just for fun . But if we really want to create a canvas toy, we need therequestAnimationFrame
It's the key to new world.I'm using SharpDX to do real-time rendering, and I created a nuget package(with linqpad-samples) here:
FlysEngine
andFlysEngine.Desktop
, which based on SharpDX/Direct2D. Which can be downloaded here: https://www.nuget.org/packages?q=FlysEngine