WoofJS to JavaScript

Similarities

Many things are the same in WoofJS and JavaScript, including:

Differences

The main difference is that regular JavaScript doesn't have sprites. Instead it has HTML elements. But once you give an HTML element an id, you can use it in JavaScript almost like how you'd use a WoofJS sprite.

Concept WoofJS JavaScript
Object Sprite HTML element
Backdrop
setBackdropColor("blue")
document.body.style.backgroundColor = "blue"
Object name
var t = new Text({text: "hello!"})
<div id="t">hello</div>
Starting Event
ready(() => {/* code here */})
document.body.onload = () => {/* code here */}
Click Event
sprite1.onClick(() => {/* code here */})
elem1.onclick = () => {/* code here */}
Every
every(30, "miliseconds", () => {/* code here */})
setInterval(() => {/* code here */}, 30)
Forever
forever(() => {/* code here */})
setInterval(() => {/* code here */}, 0)
Wait
after(1, "second", () => {/* code here */})
setTimeout(() => {/* code here */}, 1000)

.innerHTML and .innerHTML =

You can get the contents of an HTML element with:

elem1.innerHTML

You can add to the end of an HTML element with:

elem1.innerHTML += "something more"

You can set the contents of an HTML element with:

elem1.innerHTML = "something"

.style

You can use .style to set the CSS styles of an HTML element.

elem1.style.backgroundColor = "blue"

Or the font-size:

elem1.style.fontSize = "20px"
JS Bin on jsbin.com