Scene & Template Format
PinePaper uses a unified JSON format for both scenes and templates. This page documents the complete schema.
Reserved Keywords
The following are reserved property names with special meaning. Any other properties are treated as custom data.
Top-Level Reserved
| Keyword |
Type |
Description |
version |
string |
Schema version (currently “1.0”) |
width |
number |
Canvas width in pixels |
height |
number |
Canvas height in pixels |
backgroundColor |
string |
Background color (CSS format) |
items |
array |
Item definitions |
relations |
array |
Relation definitions |
interactions |
array |
Interaction triggers |
scenes |
array |
Multi-scene sequences (optional) |
metadata |
object |
Template metadata (optional) |
Item Reserved Properties
| Keyword |
Type |
Description |
id |
string |
Unique identifier |
type |
string |
Item type |
position |
[x, y] |
Position as array |
scale |
number |
Uniform scale factor |
rotation |
number |
Rotation (degrees) |
opacity |
number |
Transparency (0-1) |
fillColor |
string |
Fill color (shapes) |
fontColor |
string |
Text color |
strokeColor |
string |
Stroke color |
strokeWidth |
number |
Stroke width |
interactive |
boolean |
Responds to mouse |
animation |
object |
Simple animation config |
keyframes |
array |
Keyframe animation |
animationDuration |
number |
Animation duration |
animationLoop |
boolean |
Loop animation |
Type-Specific Reserved
| Type |
Reserved Properties |
text |
content, fontSize, fontFamily, fontWeight, alignment |
circle |
radius |
star |
points, radius1, radius2 |
polygon |
sides, radius |
triangle |
radius |
shape |
segments |
group |
children |
Relation Reserved Values
| Context |
Reserved Value |
Description |
to field |
"mouse" |
Target is cursor position |
to field |
"center" |
Target is canvas center |
Custom Properties
Any property not listed above is treated as custom data:
{
"id": "my-item",
"type": "circle",
"position": [100, 100],
"myCustomProp": "hello",
"score": 42
}
Top-Level Structure
{
"version": "1.0",
"width": 800,
"height": 600,
"backgroundColor": "#1e293b",
"items": [],
"relations": [],
"interactions": [],
"metadata": {}
}
| Field |
Type |
Required |
Description |
version |
string |
Yes |
Format version (currently “1.0”) |
width |
number |
Yes |
Canvas width in pixels |
height |
number |
Yes |
Canvas height in pixels |
backgroundColor |
string |
No |
Background color (CSS format) |
items |
array |
Yes |
Array of item definitions |
relations |
array |
No |
Array of relation definitions |
interactions |
array |
No |
Array of interaction triggers |
metadata |
object |
No |
Template metadata (makes it a template) |
Item Schema
Each item in the items array:
{
"id": "item_1",
"type": "circle",
"position": [400, 300],
"radius": 50,
"scale": 1,
"rotation": 0,
"opacity": 1,
"fillColor": "#4a9eff",
"strokeColor": null,
"strokeWidth": 0,
"interactive": true,
"animation": null,
"keyframes": null
}
Common Properties
| Property |
Type |
Default |
Description |
id |
string |
required |
Unique identifier |
type |
string |
required |
Item type (see below) |
position |
[x, y] |
[0, 0] |
Position as array |
scale |
number |
1 |
Uniform scale factor |
rotation |
number |
0 |
Rotation in degrees |
opacity |
number |
1 |
Opacity (0-1) |
fillColor |
string |
null |
Fill color (CSS format) |
strokeColor |
string |
null |
Stroke color |
strokeWidth |
number |
0 |
Stroke width in pixels |
interactive |
boolean |
false |
Responds to mouse events |
Item Types
| Type |
Description |
Additional Properties |
text |
Text element |
content, fontSize, fontFamily, fontWeight, fontColor |
circle |
Circle shape |
radius |
rectangle |
Rectangle |
- |
star |
Star shape |
points, radius1, radius2 |
triangle |
Triangle |
radius |
polygon |
Regular polygon |
sides, radius |
ellipse |
Ellipse |
- |
shape |
Generic path |
segments |
group |
Group of items |
children |
Text Properties
{
"type": "text",
"content": "Hello World",
"position": [400, 300],
"fontSize": 48,
"fontFamily": "Inter, sans-serif",
"fontWeight": "bold",
"fontColor": "#ffffff",
"alignment": "center"
}
Circle Properties
{
"type": "circle",
"position": [400, 300],
"radius": 50,
"fillColor": "#4a9eff"
}
Star Properties
{
"type": "star",
"position": [400, 300],
"points": 5,
"radius1": 50,
"radius2": 25,
"fillColor": "#fbbf24"
}
Animation Schema
Simple animations are defined inline:
{
"animation": {
"type": "pulse",
"speed": 1
}
}
Animation Types
| Type |
Description |
pulse |
Scale up and down |
rotate |
Continuous rotation |
bounce |
Vertical bouncing |
fade |
Fade in and out |
wobble |
Rotational wobble |
shake |
Horizontal shake |
swing |
Pendulum motion |
jelly |
Squash and stretch |
Animation Properties
| Property |
Type |
Default |
Description |
type |
string |
required |
Animation type |
speed |
number |
1 |
Speed multiplier |
Keyframe Animation Schema
For complex animations:
{
"keyframes": [
{ "time": 0, "properties": { "position": [100, 300], "opacity": 0 }, "easing": "easeIn" },
{ "time": 1, "properties": { "position": [400, 300], "opacity": 1 }, "easing": "easeOut" },
{ "time": 2, "properties": { "position": [700, 300], "opacity": 0.5 } }
],
"animationDuration": 2,
"animationLoop": true
}
Keyframe Properties
| Property |
Type |
Description |
time |
number |
Time in seconds |
properties |
object |
Properties at this keyframe |
easing |
string |
Easing function |
Animatable Properties
position - Position as [x, y]
x, y - Individual position components
scale, scaleX, scaleY - Scale
rotation - Rotation in degrees
opacity - Transparency
fillColor - Fill color (interpolated)
fontColor - Text color
strokeColor - Stroke color
fontSize - Text size
Easing Functions
linear - Constant speed
easeIn - Slow start
easeOut - Slow end
easeInOut - Slow start and end
bounce - Bounce effect
Relation Schema
Relations define dynamic behaviors between items:
{
"from": "item_1",
"to": "item_2",
"type": "orbits",
"params": {
"radius": 100,
"speed": 0.5
}
}
Relation Properties
| Property |
Type |
Description |
from |
string |
Source item ID |
to |
string |
Target item ID or "mouse" |
type |
string |
Relation type |
params |
object |
Type-specific parameters |
Relation Types
| Type |
Description |
Key Parameters |
orbits |
Circular motion around target |
radius, speed, direction, phase |
follows |
Move toward target |
offset, smoothing |
repels |
Move away from target |
force, maxDistance |
attracts |
Move toward target |
force, maxDistance |
attached_to |
Move with target |
offset |
points_at |
Rotate to face target |
offset_angle |
mirrors |
Mirror position |
axis |
Mouse Relations
Use "to": "mouse" for cursor-based behaviors:
{
"from": "item_1",
"to": "mouse",
"type": "repels",
"params": {
"force": 100,
"maxDistance": 200
}
}
Interaction Schema
Define click/hover behaviors:
{
"id": "trigger_1",
"itemId": "button_1",
"event": "click",
"action": "navigate",
"params": { "step": 2 },
"once": false
}
Interaction Properties
| Property |
Type |
Description |
id |
string |
Unique trigger ID |
itemId |
string |
Item to attach trigger to |
event |
string |
Event type |
action |
string |
Action to execute |
params |
object |
Action parameters |
once |
boolean |
Fire only once |
Event Types
click - Mouse click / touch tap
hover / enter - Mouse enters item
leave - Mouse leaves item
drag - Mouse drag on item
Action Types
navigate - Step navigation
show / hide - Toggle visibility
animate - Apply animation
setState - Update state variable
Adding metadata makes a scene into a saveable template:
{
"version": "1.0",
"width": 800,
"height": 600,
"backgroundColor": "#1e293b",
"items": [...],
"metadata": {
"name": "My Animation",
"category": "creative",
"description": "A beautiful animation",
"tags": ["animation", "text"],
"thumbnail": "/thumbnails/my-animation.svg",
"difficulty": "intermediate"
}
}
| Field |
Type |
Description |
name |
string |
Display name |
category |
string |
Category for grouping |
description |
string |
Description text |
tags |
array |
Searchable tags |
thumbnail |
string |
Thumbnail image path |
difficulty |
string |
beginner, intermediate, advanced |
Multi-Scene Sequences
Add scenes array for multi-scene sequences:
{
"version": "1.0",
"width": 800,
"height": 600,
"backgroundColor": "#1e293b",
"items": [...],
"scenes": [
{
"id": "scene_2",
"items": [...],
"transitions": [
{ "to": "scene_3", "trigger": "click" }
]
}
]
}
Complete Example
{
"version": "1.0",
"width": 800,
"height": 600,
"backgroundColor": "#0f172a",
"items": [
{
"id": "sun",
"type": "circle",
"position": [400, 300],
"radius": 60,
"fillColor": "#fbbf24",
"animation": { "type": "pulse", "speed": 0.5 }
},
{
"id": "planet",
"type": "circle",
"position": [550, 300],
"radius": 20,
"fillColor": "#3b82f6"
},
{
"id": "moon",
"type": "circle",
"position": [580, 300],
"radius": 8,
"fillColor": "#9ca3af"
},
{
"id": "label",
"type": "text",
"position": [400, 500],
"content": "Solar System",
"fontSize": 24,
"fontColor": "#ffffff"
}
],
"relations": [
{
"from": "planet",
"to": "sun",
"type": "orbits",
"params": { "radius": 150, "speed": 0.1 }
},
{
"from": "moon",
"to": "planet",
"type": "orbits",
"params": { "radius": 30, "speed": 0.3 }
}
],
"metadata": {
"name": "Solar System",
"category": "education",
"tags": ["space", "animation", "orbits"]
}
}