VS Code & NuGet
The IDE is one way to write sketches. The same sketches also run from VS Code with the DanaProcessing extension, and inside any .NET project with the NuGet packages. A sketch file copied out of the IDE runs as it is in both.
On this page · 3 entries
The VS Code extension
Install DanaProcessing from the Extensions view (or the .vsix from the releases), plus the .NET 10 SDK and the C# extension. Then, from the Command Palette (Ctrl+Shift+P), type DanaProcessing:
- New Sketch creates a project ready to run; Open an Example turns any of the IDE's examples into one, with its NuGet packages.
- Run Sketch (▶, Ctrl+Alt+R) opens it in its own window. Live (⚡, Ctrl+Alt+L) keeps it running with
dotnet watchand applies your edits when you save. Stop is Ctrl+Alt+S. Errors land in the Problems panel. - Export as an App makes one file per system (Windows, macOS, Linux) that runs without .NET installed, in
export/<platform>/, with thedata/folder. // nuget: NAudio, 2.2.1lines, as the IDE writes them, become package references when you run. Make This Sketch Runnable creates the project for a.cssaved from the IDE; Open in the DanaProcessing IDE goes the other way.- Open the Reference (Ctrl+Alt+H) shows the page of the name under the cursor, and hovering a DanaProcessing name links to it. Snippets:
sketch,setup,draw,mousePressed,keyPressed,grid,push,nuget.
dotnet new dana-sketch
Without VS Code, the template makes the same project from a terminal:
dotnet new install DanaProcessing.Templates
dotnet new dana-sketch -n MySketch
cd MySketch
dotnet run # or: dotnet watch run, to live-code
The NuGet packages
| Package | What it is |
|---|---|
DanaProcessing | The core: Sketch, 2D and 3D drawing, sound, PVector, PImage, math. No windows: draw off-screen, in tests or on a server. |
DanaProcessing.AvaloniaHost | The window: SketchApp.Run() and the AvaloniaSketchCanvas control. Windows, macOS and Linux. |
DanaProcessing.Templates | The dana-sketch template for dotnet new. |
Add a sketch to a program you already have:
dotnet add package DanaProcessing.AvaloniaHost
using DanaProcessing.AvaloniaHost;
SketchApp.Run(new Bubbles());
public class Bubbles : Sketch
{
public override void Setup() => Size(400, 400);
public override void Draw()
{
Background(20);
Circle(MouseX, MouseY, 40);
}
}
Projects with ImplicitUsings get using DanaProcessing; for free, like the IDE (turn it off with <DanaProcessingImplicitUsings>false</DanaProcessingImplicitUsings>). To put a sketch inside your own Avalonia window, see AvaloniaSketchCanvas.