{"id":15415874,"url":"https://github.com/davidje13/chance","last_synced_at":"2026-01-21T16:02:28.646Z","repository":{"id":151510958,"uuid":"150889242","full_name":"davidje13/Chance","owner":"davidje13","description":"Various simulations of chance-related physical objects.","archived":false,"fork":false,"pushed_at":"2024-04-19T18:26:20.000Z","size":2365,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T16:50:12.708Z","etag":null,"topics":["ios","webgl"],"latest_commit_sha":null,"homepage":"https://chance.davidje13.com/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidje13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-29T17:50:44.000Z","updated_at":"2024-04-19T18:26:23.000Z","dependencies_parsed_at":"2024-04-19T19:49:29.529Z","dependency_job_id":null,"html_url":"https://github.com/davidje13/Chance","commit_stats":{"total_commits":128,"total_committers":1,"mean_commits":128.0,"dds":0.0,"last_synced_commit":"8c74386553102c49565f62abc1551e9bf6443621"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidje13/Chance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2FChance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2FChance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2FChance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2FChance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidje13","download_url":"https://codeload.github.com/davidje13/Chance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidje13%2FChance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","webgl"],"created_at":"2024-10-01T17:10:04.539Z","updated_at":"2026-01-21T16:02:23.628Z","avatar_url":"https://github.com/davidje13.png","language":"JavaScript","readme":"# Chance\n\nVarious simulations of chance-related physical objects. Serves as a\nplayground for rendering techniques.\n\nSupports desktop and mobile browsers. Optimised for iOS and can be\nadded to the home screen.\n\n## Screens\n\n### Dice\n\n\u003cimg src=\"screenshots/dice-small.png\" alt=\"Dice preview\" width=\"200\" align=\"right\" /\u003e\n\nRigid-body-physics simulation with custom WebGL shaders defining the\ndice shapes and reflections.\n\n* Uses [GoblinPhysics](https://github.com/chandlerprall/GoblinPhysics)\n  for the physics simulation\n* Seeds dice with uniform random rotations to ensure randomness\n* Variety of dice materials, shapes and faces\n  - Wood (varnished, unvarnished and unpainted)\n  - Plastic (white and red)\n  - Sharp square / Smooth square / Truncated square / Rounded square\n  - Dots (European and Asian style) / Numbers / Words\n* Uses normal mapping and parallax mapping on the dice faces for\n  realistic dot rendering\n* Uses raytracing to render rounded dice shapes\n* Sharp shadows beneath dice\n* No rendering while stationary for energy saving\n\n### Coins\n\n\u003cimg src=\"screenshots/coins-small.png\" alt=\"Coins preview\" width=\"200\" align=\"right\" /\u003e\n\nAnimated coin toss with raytraced coin.\n\n* Uses normal mapping and parallax mapping to render coin faces\n* Uses a bespoke radial parallax mapping technique to render grooves\n  and shapes around the edges\n* Losely physics-based animation which runs independently of random\n  coin characteristics (outcome and final rotation)\n* Motion blur during animation\n* Blurred shadow beneath coin\n* No rendering while stationary for energy saving\n\n### Numbers\n\nWork in progress.\n\n### Contortion\n\n\u003cimg src=\"screenshots/contortion-small.png\" alt=\"Contortion preview\" width=\"200\" align=\"right\" /\u003e\n\nSimple friction simulation with WebGL used to render a motion-blurred\nneedle.\n\n* Picks a target segment in advance, allowing the spinner to avoid\n  states which have already been chosen\n* Calculates initial velocity required to reach target state\n* When flicked by hand, ensures roughly the correct number of spins\n  are seen to make it feel more closely related to how much force the\n  user imparted\n* WebGL rendering allows cheap and realistic motion blur\n* No rendering while stationary for energy saving\n\n### Answers Ball\n\n\u003cimg src=\"screenshots/answers-small.png\" alt=\"Answers Ball preview\" width=\"200\" align=\"right\" /\u003e\n\nIcosahedron-inside-cylinder simulation rendered using WebGL with custom\nfog simulating coloured liquid.\n\n* Uses accelerometer and gyroscope readings if available for realistic\n  movement\n* When out of sight, applies uniform random rotation to icosahedron to\n  ensure randomness\n* Layer-based volumetric rendering allows realistic appearance; letters\n  are raised above icosahedron surface and colouring is provided\n  entirely by distance from the camera (liquid depth)\n* No rendering while stationary or out-of-sight for energy saving\n\n## Running Locally\n\nDue to the use of web modules, this project cannot be served from the\nfilesystem directly; a web server must be used. A simple example:\n\n```\nnpm install -g http-server;\nhttp-server . -p 8080 -o;\n```\n\nAlso note that as this project uses git modules, you should clone\nwith the `--recursive` flag (or run the following if you cloned\nwithout it):\n\n```bash\ngit submodule update --init --recursive\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidje13%2Fchance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidje13%2Fchance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidje13%2Fchance/lists"}