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

feat: Allow color computations in MathFormula and use to allow computed Turtle colors #530

Merged
merged 43 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
29ee6b7
feat: add chroma.js colors as data type to mathjs
gwhitney Jan 15, 2025
8e964f0
feat: allow turtle stroke widths and color to vary
gwhitney Jan 18, 2025
d0470fd
feat: introduce formula parameters to Turtle
gwhitney Jan 20, 2025
062b897
feat: Reconfigure display of dependent parameters
gwhitney Jan 20, 2025
97c4e95
fix: correct syntax of regex replacement in color formulas
gwhitney Jan 20, 2025
281cc6d
chore: incorporate old Grid changes to get param improvements
gwhitney Jan 20, 2025
5dce221
feat: Streamline presentation of parameters
gwhitney Jan 20, 2025
f32e96c
fix: Don't indent Turtle parameters despite depending on ruleMode
gwhitney Jan 20, 2025
fddca11
chore: insert comma lint wants
gwhitney Jan 20, 2025
3dda53d
ui: make Turtle colorChooser insert in the appropriate color param
gwhitney Jan 21, 2025
c6d1b2b
ui: copy list rules into formulas whenever they change
gwhitney Jan 21, 2025
66ee2db
feat: Compute Turtle segment parameters with formulas
gwhitney Jan 22, 2025
cabef6a
dummy: Enable Github snapshots
gwhitney Jan 22, 2025
c11261d
test: update Github CI snapshots
gwhitney Jan 22, 2025
7e849be
fix: space new chooser color; param description; array in formula
gwhitney Jan 25, 2025
c2b98b6
add chroma constructor in expression tests
katestange Jan 26, 2025
cafbfff
fix: get all chroma tests working except evaluate scale
gwhitney Feb 1, 2025
eaf3fd9
fix: draw 'negative-length' steps, too
gwhitney Feb 1, 2025
0fb5c03
fix: initial turn formula <=> initial turn list; chroma(n) greyscale
gwhitney Feb 1, 2025
2865365
fix: allow chroma constructors & other chroma expressions in strokeCo…
gwhitney Feb 3, 2025
364c637
refactor: Switch away from built-in color picker
gwhitney Feb 4, 2025
3fa6c4c
fix: Don't allow deletion of last color in COLOR_ARRAY
gwhitney Feb 4, 2025
a9d32a6
chore: lint wanted a carriage return
gwhitney Feb 4, 2025
e26ae68
fix: Reset formulas when ruleMode or domain changes
gwhitney Feb 4, 2025
6165b9c
feat: add a rainbow() color function
gwhitney Feb 5, 2025
23c1c4a
feat: Expand the collection of symbols allowed in Turtle formulas
gwhitney Feb 5, 2025
077c49b
doc: Add color computation docs and make safeNumber safer
gwhitney Feb 7, 2025
c0c8789
feat: Add Angle measure deg/rad and Angle is turn/bearing toggles
gwhitney Feb 8, 2025
55dd7d7
fix: Don't fill in NaN when the array fields empty
gwhitney Feb 9, 2025
81c66b1
fix: Don't refresh parameters the person exploring just changed
gwhitney Feb 9, 2025
3d93afe
ui: always show parameters that happen to be invalid
gwhitney Feb 9, 2025
6133aa9
fix: Turtle resets invalid list rule params when rule mode -> Formula
gwhitney Feb 11, 2025
60e8a43
fix: Toggle the color picker on every appropriate click
gwhitney Feb 11, 2025
1bbcf89
Featured Specimens Galore
katestange Feb 12, 2025
24631f8
chore: finalize tests and snapshots
gwhitney Feb 12, 2025
7972dc9
test: try updating to setup-node@v4
gwhitney Feb 12, 2025
fae5134
test: try updating to checkout@v4 and using specific Node version
gwhitney Feb 12, 2025
d18332e
chore: oops didn't realize node-version specified two different places
gwhitney Feb 12, 2025
2dc0863
test: finalize GitHub ci snaps; visual git diff images if magick present
gwhitney Feb 12, 2025
e9afb9e
doc: distinctive typography for Turtle param names to ease reading
gwhitney Feb 13, 2025
af654ec
gallery tweaks
katestange Feb 13, 2025
97886c6
chore: Unicode beats HTML entities any day ;-)
gwhitney Feb 13, 2025
ec28da1
feat: Progressively sharpen Zeta Zero specimen & update tests
gwhitney Feb 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.png diff=image
2 changes: 2 additions & 0 deletions .gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[diff "image"]
command = sh tools/imgdiff.sh
12 changes: 6 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22.x'
- name: Install dependencies
run: npm install
- name: Lint
Expand All @@ -27,15 +27,15 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20.x'
node-version: '22.x'
- name: Install d2 document generator
run: curl -fsSL https://d2lang.com/install.sh | sh -s --
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion doc/visualizer-in-depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ Make sure you do fill them all in -- if you attempt to draw with an

Any time a parameter value is assigned into its corresponding property in your
Visualizer object, the `parametersChanged()` method of your Visualizer is
called with a list of the parameter name(s) that changed. The default
called with a Set of the parameter name(s) that changed. The default
implementation of this method in the P5Visualizer base class resets the
display of the visualizer so that it re-runs from the beginning. So you likely
do not need to modify that behavior. However, there could be a specialized
Expand Down
4 changes: 2 additions & 2 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const baseConfiguration = {
/* Run tests in files in parallel */
fullyParallel: false,
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Retry more on CI */
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions e2e/tests/featured.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ test.describe('Featured gallery images', () => {
details.tag = '@webGL'
}
test(featProps.name, details, async ({page, browserName}) => {
const short = featProps.name.replaceAll(' ', '')
const short = encodeURIComponent(
featProps.name.replaceAll(' ', '')
)
const testURL = `/?frames=64&randomSeed=${short}&${feature.query}`
await page.goto(testURL)
await expect(
page.locator('#specimen-bar-desktop').getByText('play_arrow')
).toHaveId('pause-button', {timeout: 30000})
const matchParams =
browserName === 'firefox' && details.tag === '@webGL'
? {maxDiffPixelRatio: 0.02}
? {maxDiffPixelRatio: 0.01}
: {}
expect(
await page.locator('#canvas-container').screenshot()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified e2e/tests/featured.spec.ts-snapshots/BeattyDNA-firefox-linux.png
2 changes: 2 additions & 0 deletions e2e/tests/gallery.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ test.describe('Gallery', () => {
)
})
test('clicking on a featured item', async ({page}) => {
const danceCard = await page.locator('.card-body >> nth=2')
await expect(danceCard.locator('.titlespan')).toContainText(/Dance/)
await page.locator('.card-body >> nth=2').click()
await expect(page.url()).not.toContain('gallery')
await expect(
Expand Down
3 changes: 2 additions & 1 deletion e2e/tests/scope.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ test.describe('Scope: on some featured visualization', () => {
const lookFor = 'Random'
const andThenFind = 'Random integers 0 to 9'
await page.locator('#sequenceTab .visualizer-info').click()
await page.getByText(lookFor, {exact: true}).click()
const itemToClick = await page.getByText(lookFor, {exact: true})
await itemToClick.click()
await expect(
await page.locator('#sequenceTab .item-name').innerText()
).toMatch(andThenFind)
Expand Down
Loading