Keys.bind("F12", {System.screenshot});
Keys.bind("F8", {App.GUI.GiveBugReport});
Keys.bind("pause", {Sim.running=false; App.Step}); // Press this to take one time step when paused

exit = {System.exit};
quit = {System.exit};
print = {Console.print};

time = {Sim.time};
sin = {math.sin};
cos = {math.cos};

clamp = (t,mn,mx)=>{t<mn ? mn : t>mx ? mx : t};
lerp = (a,b,t)=>{(1-t)*a + t*b};

/*
Some code examples:

spawnBoxRow = (offset, n)=>{for(n, (x)=>{Scene.addBox({pos = offset + [x, 0]})})};
spawnPyramid = (n)=>{for(n, (i)=>{spawnBoxRow([(n - i) * 0.5, n - i], i)})}; // A pyramid of boxes
makeRing = (r, n)=>{
    list = [];
    for(n, (i)=>{
        a = (2 * math.pi * i) / n;
        list = list ++ [r * [cos(a), sin(a)]]
    });
    list
};

spawnRing = { Scene.addPolygon { surfaces = [ makeRing(1, 48), makeRing(0.5, 48) ] } }; // Creates a 2D-torus
*/

groovyOn = {
	App.fadeColor = [0.8, 0, 0.9];
	App.fadeTranslate = { [3 * sin(time), 2 * sin(time)] };
	App.fadeRotate = { sin(System.time*1.2) };
	App.Background.skyColor = [0,0,0,0];
};

groovyOff = {
	App.fadeColor = [0, 0, 0];
	App.Background.skyColor = [0.45, 0.55, 1, 1];
};
