Waterbear Playground

Controls

Contains flow control, messaging, looping, variables, and conditionals.

each frame
frame
elapsed
set
to
update to
loop over
broadcastmessage with data
when I receive message with data
if
if
else
ifthenelse
log
Ask and store answer as
ignore blocks
comment
alert
Sprites

Sprites are images or shapes that can have momentum and heading direction applied to them for animation and games.

sprite with
accelerate by
set velocity to
get velocity
get speed
get X velocity
get Y velocity
get X position
get Y position
rotateby
rotate to degrees
move
move to
draw
apply force
bounce at edge
wrap at edge
stop at edge
is collision
Sound

Play and manipulate existing sound files or synthesize new sounds.

synthwaveattackrelease
audio
noteoctavebeats
play chordsynth note octave
play audio
play notes
synthmml
set tempo
pause
keyssynth
sound effect
Arrays

Arrays are lists of things. You can add, remove, and loop over these lists.

create array
copy array
item fromat index
combinewith
Make string fromseparated by
append
prepend
length
remove item at
remove last value
remove first value
reverse
Boolean

Booleans are either True or False. There are many operations for comparing and mixing them.

true
false
and
or
xor
not
Date

Dates are used to represent a date and to do basic calculations.

today
yyyymmdd
date+/- days
date+/- months
date+/- years
get day of week
get day
get month
get month by name
get year
Stage

Stage is the area where scripts are performed.

clear to
Stage Width
Stage Height
Center x
Center y
Center point
Random x
Random y
Colors

There are several ways to specify colors.

redgreenblue
redgreenbluealpha
grey
huesaturationlightness
huesaturationlightnessalpha
fill style
stroke style
shadow colorshadow blur
Images

Images are pictures loaded from the web. They can be positioned and resized.

image from url
blank image with widthheight
image width
image height
setwidth
setheight
scaleby
flip horizontal
flip vertical
flip both
setsize
drawat
draw on
Math

In addition to performing math on numbers you can also use many operations on arrays and vectors too.

as number
+
×
÷
=
<
>
modulus
round
absolute value
sign of
floor
ceiling
to the power of
square root of
cube root of
root ofto degree
logarithm ofto base
max
min
sine
cosine
tangent
arcsine
arcosine
arctangent
pi
e
tau
degrees to radians
radians to degrees
Random

There are many types of randomness in Waterbear.

random float
random int fromto
noise from xyz
random item from
Vectors (Points)

Waterbear vectors are x,y coordinates that can be used as points, but also have a direction and magnitude (useful for speed, acceleration, distance).

vector at xy
vector at anglemagnitude
rotate to degrees
rotate by degrees
degrees
magnitude
x
y
×
+
normalize
random unit vector
from array
random point
unit vector <1,1>
zero vector <0,0>
as array
Objects

Objects are general-purpose containers where you can associate names (keys) with objects (values) like in a dictionary.

empty object
key with value
fromvalue of
keys from
Strings

Strings are simple bits of text. You can search them, combine them, and break them up.

convert
to string
spliton separator
concatenatewith
repeat
times
get characterfrom
get characterfrom end of
substring ofstarting atof length
substring offromto
is substring of
position ofin
inreplacewith
trim whitespace of
convert
to uppercase
convert
to lowercase
matches
doesn't match
starts with
ends with

The blocks below are for writing your text to the screen.

font
align text to the
text baseline
fill textxy
fill textxymax width
stroke textxy
stroke textxymax width
width of text
Shapes

Shapes are pictures made by drawing a geometric shape rather than loading an image file.

draw the shape
line width
line cap style
line join style
circle atradius
ellipse athorizontal radiusverticle radiusrotation
rectangle atwidthheight
triangle with points abc
polygon with points
regular polygon atsidescorner radius
star atpointsinner radiusouter radius
line fromto
arc with radiuscentered at pointstart angleend angle
bezier curve fromtofirst control pointsecond control point
quadratic curve fromtocontrol point
clip with
pathtype
last point
bezier point at positionstart pointend pointfirst control pointsecond control point
tangent to bezier curve at positionstart pointend pointfirst control pointsecond control point
Rects

It turns out to be frequently useful to be able to represent a rectangle.

xywidthheight
positionsize
from array
position of
size of
x of
y of
width of
height of
Input

Programs can get input from the mouse, touch, key presses, and more.

Pointer x
Pointer y
Pointer Down
KeyPressed?
whenkey pressed
when pointer pressed
when pointer released
when pointer moves
tilt direction
Geolocation

Where in the world is your progam running?

my current location
when my location changes
my current location
latitude of
longitude of
altitude (m) of
direction from north of
speed (m/s) of
Sizes

A size captures both width and height in one convenient package.

size from widthwidth unitsheightheight units
size from arraywidth unitsheight units
width from sizewidth units
height from sizeheight units
size as array
Workspace