Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(examples): restructure/refactor/simplify canvas-recorder example #412

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

postspectacular
Copy link
Member

  • re-order functions & initialization process
  • consolidate global vars into State (now defined inside init())
  • update grid to store pre-defined text elements (avoiding multiple arrays and re-allocations each frame)
  • use vector algebra for computing various state values
  • add global RND to allow switching to deterministic behavior
  • use thi.ng/adapt-dpi to simplify HDPI canvas resizing
  • update naming & exports convention for constants
  • simplify sentences/symbols defs/handling (avoiding slicing)
  • extrace start/stop recording functions
  • update UI button logic, update init() to stop any active recording
  • add more doc strings / comments
  • update pkg deps & meta
  • move screenshot to /assets/examples

cc @nclslbrn

…mple

- re-order functions & initialization process
- consolidate global vars into State (now defined inside `init()`)
- update grid to store pre-defined text elements (avoiding multiple
  arrays and re-allocations each frame)
- use vector algebra for computing various state values
- add global `RND` to allow switching to deterministic behavior
- use thi.ng/adapt-dpi to simplify HDPI canvas resizing
- update naming & exports convention for constants
- simplify sentences/symbols defs/handling (avoiding slicing)
- extrace start/stop recording functions
- update UI button logic, update init() to stop any active recording
- add more doc strings / comments
- update pkg deps & meta
- move screenshot to /assets/examples
@postspectacular
Copy link
Member Author

postspectacular commented Oct 6, 2023

@nclslbrn Forgot to mention: I also updated the mime type for the canvas recorder (link), since the current default isn't supported by Firefox (only Chrome). Safari does only seem to support video/mp4;codecs="AVC1.4d002a,mp4a.40.1" but none of the WebM containers/codecs (so recording won't currently work there). Will add some detection function to the thi.ng/dl-asset package and then update this example later...

@nclslbrn
Copy link
Contributor

nclslbrn commented Oct 6, 2023

@postspectacular thanks, that's a huge refactoring, especially to put all the grid variations in state. I tried to put the UI (buttons) and canvas in the same render/compute function but without success, I'm glad I know how to do it now.

I had seen this Codec problem but I didn't know if it was a choice to use a particular Codec (for better rendering) or a bug.

@postspectacular postspectacular merged commit 5096161 into develop Oct 6, 2023
1 of 3 checks passed
@postspectacular postspectacular deleted the feature/example-refactor branch October 6, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants