mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 21:58:31 +00:00
commit
734e451bd9
@ -1,16 +1,20 @@
|
|||||||
# my-patterns
|
# my-patterns
|
||||||
|
|
||||||
This directory can be used to save your own patterns.
|
This directory can be used to save your own patterns, which then get
|
||||||
|
made into a pattern swatch.
|
||||||
|
|
||||||
0. fork the strudel repo
|
0. fork and clone the strudel repository
|
||||||
1. Save one or more .txt files here.
|
1. run `npm run setup` in the strudel folder
|
||||||
2. and run `npm run repl`
|
1. Save one or more .txt files in this folder
|
||||||
3. open `http://localhost:3000/my-patterns` !
|
2. run `npm run repl` in the top-level strudel folder
|
||||||
|
3. open `http://localhost:3000/swatch/` !
|
||||||
|
|
||||||
## deploy
|
## deploy
|
||||||
|
|
||||||
1. in your fork, go to settings -> pages and select "Github Actions" as source
|
1. in your fork, go to settings -> pages and select "Github Actions" as source
|
||||||
2. edit `website/public/CNAME` to contain `<your-username>.github.io/strudel`
|
2. edit `website/public/CNAME` to contain `<your-username>.github.io/strudel`
|
||||||
3. edit `website/astro.config.mjs` to use site: `<your-username>.github.io/strudel` and base `/strudel`
|
3. edit `website/astro.config.mjs` to use site: `<your-username>.github.io/strudel` and base `/strudel`
|
||||||
4. go to Actions -> "Build and Deploy" and click "Run workflow"
|
4. go to Actions -> `Build and Deploy` and click `Run workflow`
|
||||||
5. view your patterns at `<your-username>.github.io/strudel/my-patterns`
|
5. view your patterns at `<your-username>.github.io/strudel/swatch/`
|
||||||
|
|
||||||
|
Alternatively, github pages allows you to use a custom domain, like https://mycooldomain.org/swatch/. [See their documentation for details](https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site).
|
||||||
|
|||||||
@ -1,17 +1,18 @@
|
|||||||
import { controls, Pattern, getDrawContext, silence, scheduler } from './index.mjs';
|
import { controls, Pattern, getDrawContext, silence, scheduler } from './index.mjs';
|
||||||
const { createParams } = controls;
|
const { createParams } = controls;
|
||||||
|
|
||||||
let clearColor = '#20001010';
|
let clearColor = '#22222210';
|
||||||
let currentSmear = 0.5;
|
|
||||||
export let syncAnimationWithScheduler = true;
|
|
||||||
|
|
||||||
Pattern.prototype.animate = function (callback) {
|
Pattern.prototype.animate = function ({ callback, sync = false, smear = 0.5 } = {}) {
|
||||||
window.frame && cancelAnimationFrame(window.frame);
|
window.frame && cancelAnimationFrame(window.frame);
|
||||||
const ctx = getDrawContext();
|
const ctx = getDrawContext();
|
||||||
const { clientWidth: ww, clientHeight: wh } = ctx.canvas;
|
const { clientWidth: ww, clientHeight: wh } = ctx.canvas;
|
||||||
|
let smearPart = smear === 0 ? '99' : Number((1 - smear) * 100).toFixed(0);
|
||||||
|
smearPart = smearPart.length === 1 ? `0${smearPart}` : smearPart;
|
||||||
|
clearColor = `#200010${smearPart}`;
|
||||||
const render = (t) => {
|
const render = (t) => {
|
||||||
let frame;
|
let frame;
|
||||||
if (syncAnimationWithScheduler) {
|
if (sync) {
|
||||||
t = scheduler.now();
|
t = scheduler.now();
|
||||||
frame = this.queryArc(t, t);
|
frame = this.queryArc(t, t);
|
||||||
} else {
|
} else {
|
||||||
@ -21,13 +22,7 @@ Pattern.prototype.animate = function (callback) {
|
|||||||
ctx.fillStyle = clearColor;
|
ctx.fillStyle = clearColor;
|
||||||
ctx.fillRect(0, 0, ww, wh);
|
ctx.fillRect(0, 0, ww, wh);
|
||||||
frame.forEach((f) => {
|
frame.forEach((f) => {
|
||||||
let { x, y, w, h, s, r, a = 0, fill = 'darkseagreen', smear } = f.value;
|
let { x, y, w, h, s, r, a = 0, fill = 'darkseagreen' } = f.value;
|
||||||
if (smear && smear !== currentSmear) {
|
|
||||||
currentSmear = smear;
|
|
||||||
let smearPart = Number((1 - smear) * 100).toFixed(0);
|
|
||||||
smearPart = smearPart.length === 1 ? `0${smearPart}` : smearPart;
|
|
||||||
clearColor = `#200010${smearPart}`;
|
|
||||||
}
|
|
||||||
w *= ww;
|
w *= ww;
|
||||||
h *= wh;
|
h *= wh;
|
||||||
if (r !== undefined && a !== undefined) {
|
if (r !== undefined && a !== undefined) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user