Revision as of 10:37, 9 June 2019 by Jonathan50 (talk | contribs) (←Created page with "{{other version|3.0|2.0|1.4}} The '''Scratch 3.0 file format''' is the format used to store exported Scratch 3.0 projects and sprite...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This article or section documents the current version of Scratch (version 3.0). For this article in Scratch 2.0, see Scratch File Format (2.0). For this article in Scratch 1.4, see Scratch File Format (1.4).

The Scratch 3.0 file format is the format used to store exported Scratch 3.0 projects and sprites. These are ZIP archives which contain information encoded in a text-based format called JSON and project media in separate files. Projects have the extension .sb3, and sprites .sprite3.

Project Files

An .sb3 file is a ZIP archive containing one JSON file, project.json. Backdrops, costumes, and sounds are stored as individual files with names beginning with their MD5 checksums followed by a file extension.

Sprite Files

.Sprite3 files are the same except that the JSON file is named "sprite.json" and it represents the sprite.

Format

Document.png Please expand this article or section. You can help by adding more information if you are an editor. More information might be found in a section of the talk page. (Date?)

Projects

Projects have the following properties:

targets
An array of targets.
monitors
An array of monitors.
extensions
An array of the names of the extensions used.
meta
Metadata about the project's author.

Targets

Targets have the following properties:

isStage
true if this is the stage, false otherwise.
name
The name.
variables
An object associating IDs with arrays representing variables whose first element is the variable's name and second is the variable's value.
lists
An object associating IDs with arrays representing lists whose first element is the list's name and second is the list as an array.
broadcasts
An object associating IDs with broadcast names.
blocks
An object associating IDs with blocks.
comments
An object associating IDs with comments.
currentCostume
The costume number.
costumes
An array of costumes.
sounds
An array of sounds.
volume
The volume.
layerOrder
The layer number.

The Stage

The stage has the following properties as well as those of all targets:

tempo
The tempo in BPM.
videoTransparency
The video transparency.
videoState
"Off" if video sensing has been turned off and is off; "on-flipped" if flipped; "on" otherwise.
textToSpeechLanguage
The language of the Text to Speech extension.

Sprites

Sprites have the following properties as well as those of all targets:

visible
true if the sprite is visible and false otherwise.
x
The x-coordinate.
y
The y-coordinate.
size
The sprite's scaling factor as a percentage.
direction
The sprite's direction in degrees clockwise from North.
rotationStyle
The name of the rotation style: "all around", "left-right", or "don't rotate".

Blocks

Blocks have the following properties:

opcode
A string naming the block.
next
The ID of the following block or null.
parent
If the block is a stack block, this is the ID of the preceding block or null. If the block is a reporter, this is the ID of the block into which it has been dropped.
inputs
An object associating input names to arrays representing inputs.
fields
shadow
topLevel

Assets

An asset is a costume or sound. (Backdrops are considered costumes.) They have the following properties:

assetId
The MD5 hash of the asset file.
name
The name.
md5ext
The file name of the asset file.
dataFormat
The name of the format of the asset file.

Costumes

Costumes have the following properties as well as those of all assets:

bitmapResolution
rotationCenterX
The x-coordinate of the rotation center.
rotationCenterY
The y-coordinate of the rotation center.

Sounds

Sounds have the following properties as well as those of all assets:

rate
The sampling rate of the sound in Hertz.
sampleCount.
The number of samples.

See Also