a PaintCode - Dynamic Shapes

Dynamic Shapes

PaintCode has a great feature called dynamic shapes. With dynamic shapes, you can define how shapes should behave when they are resized. This dynamic behavior is then baked in the generated code.

Dynamic Shapes

Frames and constraints have much wider range of uses than just a resizing. You can use them to change the shapes in many interesting and useful ways:

Another dynamic bezier example

To make a shape dynamic:

Of course, a single frame may contain many shapes.



To create a Frame, simply select the “Frame” tool from the toolbar, then click and drag in the canvas.

Frames are not shapes. By themselves, they do not draw anything. However, they affect the generated code. Frames also affect the dynamic behavior of shapes inside them.

In the generated code, a frame corresponds to a method parameter:

Frame's rectangle variable

Dynamic shapes derive their sizes and coordinates from their enclosing frames.

When you resize a frame in the canvas, all derived shapes are resized/moved around, too. To suppress this behavior, hold down the COMMAND key while resizing the frame.