CIT AViz Core API
Getting started
CIT AViz is a Java framework for drawing graphics and creating interactive
sketches. The main interfaces are in the
cit244.api package.
Drawing and interaction
Graphics is the main drawing
reference. It provides methods for backgrounds, fill and stroke colors,
lines, shapes, text, images, and coordinate transformations.
The other interfaces in cit244.api
provide the basic structure and inputs for a sketch:
Sketch: the code that initializes and draws a sketch.Input: keyboard keys, mouse position, clicks, and scrolling.Frame: elapsed time, frame timing, and frame count.Params: adjustable controls such as sliders and toggles.
A simple sketch
import cit244.api.*;
import cit244.app.SketchApp;
public class MySketch implements Sketch {
@Override
public void render(Graphics g, Frame f, Params p, Input in) {
g.background(30);
g.noStroke();
g.fill(255, 160, 40);
g.circle(in.mouseX(), in.mouseY(), 40);
}
public static void main(String[] args) {
SketchApp.run(new MySketch());
}
}
The sketch draws an orange circle at the mouse position.
Sketch.render is called once per frame.
Window size and renderer
SketchApp launches the sketch. The window size
can be specified directly; the compatibility renderer is available if the
default OpenGL renderer causes problems.
SketchApp.run(new MySketch(), 1200, 700); // 1200 by 700 window
SketchApp.runCompat(new MySketch()); // Compatibility renderer (Java2D)
Use AppConfig for fullscreen modes, window
titles, and other application settings.
Additional APIs
ColorandColors: immutable RGB and RGBA colors, color conversion, and named color constants.Vec2: two-dimensional positions and vectors, including arithmetic, distance, and interpolation.- Math and motion:
Mathfprovides interpolation and other math helpers.Curve,Mapping, andDampedprovide easing, range mapping, and smooth changes over time. Noise: smooth pseudo-random values for procedural patterns and motion.- Images and animation: classes in
cit244.api.imageincludeSprite,SpriteSheet,SpriteDraw, andAnimation.
Packages
Package
Description
Main API for CIT AViz sketches, including drawing, input, timing, and controls.
Immutable colors, color-space conversion, and ready-made color palettes.
Two-dimensional geometry and vector operations.
Images, sprite regions, sprite sheets, and frame-based animation.
Application-level configuration and launchers.
Math and utility helpers for graphics and animation.
Smooth pseudo-random noise for procedural graphics and animation.