Skip to content

Commit

Permalink
Merge pull request #11 from ben9583/0.3.1
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
ben9583 authored Jun 15, 2022
2 parents 88ef6cd + 1ac01a7 commit ab2b0ea
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "solar-sim"
version = "0.3.0"
version = "0.3.1"
authors = ["Ben Plate <bplate9583@gmail.com>"]
edition = "2018"
description = "Physics simulator written in Rust WASM for use in Solar Sim website"
Expand Down
8 changes: 3 additions & 5 deletions website-src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const canvas2 = document.getElementById("trails");
const ctx = canvas.getContext("2d");
const ctx2 = canvas2.getContext("2d");

let playing = true;
let tickTime = performance.now();

function step(simulate) {
Expand Down Expand Up @@ -145,20 +146,17 @@ function step(simulate) {

if(debug && count % 10 == 0) drawTickTimeElem.innerHTML = Math.round((performance.now() - tickTime) * 1000);

window.requestAnimationFrame(step);
if(playing) window.requestAnimationFrame(step);
}

let playing = true;

const toggleButton = document.getElementById("toggle");

toggleButton.addEventListener("click", (elem, e) => {
if(playing) {
clearInterval(proc);
toggleButton.innerHTML = "Play";
} else {
proc = setInterval(() => step(true), 10);
toggleButton.innerHTML = "Pause";
window.requestAnimationFrame(step);
}
playing = !playing;
});
Expand Down
4 changes: 2 additions & 2 deletions website-src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion website-src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solar-sim-app",
"version": "0.3.0",
"version": "0.3.1",
"description": "Creates the Solar Sim website.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit ab2b0ea

Please sign in to comment.