Comments (8)
A little update: I'm prototyping a rewrite for this in my advent of code repo. eg: https://github.com/l2wilson94/AdventOfTode/blob/main/2021/day03a/show.js
I've called it "show" instead of "stage" as a working title just so it doesn't clash names. I'll change it back to "stage" afterwards probably.
from habitat.
https://github.com/l2wilson94/AdventOfTode/blob/main/2021/day06b/show.js
So far so good. Maybe show
is a better name than stage
? You start it by doing Show.start()
. The problem with show
is that it's not clear if show
is a verb or noun. So maybe not actually.
It creates a fullscreen canvas that has its own tick function, and automatically resizes and stuff.
You can specify various options.
const show = Show.start({interval: 1000 / 60, overload: 2, scale: 0.95, paused: false})
const {canvas, context} = show
show.tick = () => {
// your update and draw code goes here
}
overload: runs more than one tick per interval.
scale: multiplies the size of the canvas.
paused: whether the stage starts paused or not (toggle with the spacebar)
interval: time between ticks
from habitat.
I've continued to work on this in my Genuary repo: https://github.com/l2wilson94/Genuary
from habitat.
I have now brought over the show library to MagicPond, and I'm continuing to work on it there. I've switched from setInterval
back to requestAnimationFrame
as chrome seems to be working better with it again (on my devices at least).
https://github.com/TodePond/Genuary
from habitat.
I've continued working on the rehaul in incubation! Here it is currently: https://github.com/TodePond/NewPond/blob/main/GameOfLiving/show.js
It's still called show
instead of stage
just so the name doesn't clash while I'm working on it. But I will change it to stage
when it moves into the habitat library!
This is how you use it:
const show = Show.start()
show.update = () => {
// ...
}
Previously, you had to make sure you ran it after the page fully loaded. But you don't anymore :) It will now automatically wait for the page to load and get started when it's ready now.
from habitat.
I'm writing up some draft documentation for it: https://todepond.gitbook.io/habitat/libraries/show
from habitat.
Hurry up and merge this into Habitat!! Latest version? https://github.com/TodePond/PaintPond/blob/main/show.js
from habitat.
Finally done!
from habitat.
Related Issues (20)
- Components should be able to specify dependencies?
- Use an options helper HOT 1
- Update docs to highlight use of options HOT 1
- Bring things across to Options HOT 1
- Merge Machine and State, and allow nesting
- Fix incorrect entity example HOT 1
- batch signal updates
- context of stage can be an object HOT 1
- Rectangle component overrides dimensions signal with array
- `fire` doesn't pass arguments to state
- You should be able to change states when in the `enter` state machine event
- Pointer (etc) position should be initialised to `undefined` not `[undefined, undefined]`
- `absolutePosition` doesn't take scale into account
- Change state machine states to be classes instead of instances
- the `fire` method of `State` shouldn't be a property
- completely rethink Options
- Boost performance of SVG + HTML functions
- Boost performance of signals
- Pull over Arroost mods
- Validation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from habitat.