< Language Tutorials

Document stub.png This article or section may not have content matching Scratch Wiki editing standards. Please improve it according to Scratch Wiki:Guidelines and Scratch Wiki:Editing Conventions. (October 2021)

This article will show how to make a program in ProcessingJS.

About ProcessingJS

ProcessingJS is a remake of JavaScript. It includes:

  • More visual features
  • Simpler coding

ProcessingJS

background(255,255,255);//This sets the background to the specified RGB(A) color

textSize(20);//Sets the text size

fill(0, 0, 0);//This sets the fill for shapes/text (but not for point(x,y);, in which stroke(r,g,b,a)l is used)

text("Hello World!", width/2, height/2);//This outputs text to the screen (the width/height return the width/height of the screen

Scratch

In Scratch, this is the equivalent code:

when gf clicked
erase all
go to x: (0) y: (0)
set [i v] to (0)
set [text v] to [Hello World!]
repeat (length of (text))
change [i v] by (1)
switch costume to (join (letter (i) of (text)) [t])
stamp
change x by (item (costume [number v]) of [letter widths v])

The costumes should have "t" after their name. The list must be filled with letter width + some spacing.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.