This repository was archived by the owner on Apr 27, 2026. It is now read-only.
How to render real-time animations in Polyglot Notebook using C#? #4135
|
I am using .NET Polyglot Notebook (C#). I want to render animations (not static images) inside a notebook cell — What I have tried:
What I want:
Thanks |
Answered by
jonsequitur
Jan 26, 2026
Replies: 2 comments
|
One approach is to use the Here's an example: using Microsoft.DotNet.Interactive.Formatting;
var display = "".Display("text/html");
foreach (var color in new[]{"red", "green", "yellow", "blue", "black"})
{
var html = $"""<p style="background-color:{color}">{color}!</p>""".ToHtmlContent();
display.Update(html);
await Task.Delay(750);
} |
0 replies
Answer selected by
PrashantUnity
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One approach is to use the
Updatemethod on theMicrosoft.DotNet.Interactive.DisplayedValueinstance returned by theDisplayextension method. This will work but the refresh rate will be pretty low. You can also use JavaScript libraries directly if you want to use proper animation APIs.Here's an example: