Skip to content
Discussion options

You must be logged in to vote

One approach is to use the Update method on the Microsoft.DotNet.Interactive.DisplayedValue instance returned by the Display extension 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:

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);
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by PrashantUnity
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants