loadImage() and image()
Loads an image into the code's assets
Last updated
Loads an image into the code's assets
Last updated
Loads an image into memory from an external source so that it can be used in code. The sourceURL can be a web address (for example "http://donkeyImage.png") - this is the usual situation - or the local address if the file is stored with the rest of your code.
Once an image is loaded, image(assets['NAME'], x, y, w, h) can be called to draw the image at position (x, y) with width w and height h
Find these documents helpful? Let the people who made them help your child learn to code at Strivemath!
We'd love to hear your Feedback/Comments here.
Input | Description |
---|---|
sourceURL
web or local URL of image to be loaded
NAME
name for variable of image in code
x
x co-ordinate of bottom left corner of image
y
y co-ordinate of bottom left corner of image
w
width of image
h
height of image