This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"Alabama", | |
"Alaska", | |
"American Samoa", | |
"Arizona", | |
"Arkansas", | |
"California", | |
"Colorado", | |
"Connecticut", | |
"Delaware", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- screenshake | |
shake = 0 | |
if shake>0 then | |
shake-=1 | |
camera() | |
if shake>0 then | |
camera(-2+rnd(5),-2+rnd(5)) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const wasm = require('./main.rs') | |
wasm.initialize({noExitRuntime: true}).then(module => { | |
// Create a Javascript wrapper around our Rust function | |
const add = module.cwrap('add', 'number', ['number', 'number']) | |
console.log('Calling rust functions from javascript!') | |
console.log(add(1, 2)) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
println!("Hello, world!"); | |
} | |
// Functions that you wish to access from Javascript | |
// must be marked as no_mangle | |
#[no_mangle] | |
pub fn add(a: i32, b: i32) -> i32 { | |
return a + b | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.js', | |
path: __dirname + '/build', | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.rs$/, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello World</title> | |
</head> | |
<body> | |
<div id="container"></div> | |
<script src="build/bundle.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"compile": "webpack --progress", | |
"serve": "http-server" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic setup for a p5.js sketch | |
// This function gets called once at the start of the page load | |
function setup() { | |
// This creates an 800x800 HTML canvas element | |
createCanvas(800, 800); | |
} | |
// This function gets called ~60 times/second | |
function draw() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
simpleGradient fuchsia,color(100,200,200),yellow | |
move -3,-2,0 | |
scale 2.1 | |
x = 0 | |
y = 0 | |
5 times | |
x = 0 | |
y += 0.1 | |
move 0,y,0 | |
pushMatrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ian - Hey Everyone! |