mirror of
https://github.com/bspeice/speice.io
synced 2025-09-08 23:55:02 -04:00
Reorganize a bit, write some more
This commit is contained in:
4
blog/2024-11-15-playing-with-fire/src/coefs.ts
Normal file
4
blog/2024-11-15-playing-with-fire/src/coefs.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export interface Coefs {
|
||||
a: number, b: number, c: number,
|
||||
d: number, e: number, f: number
|
||||
}
|
13
blog/2024-11-15-playing-with-fire/src/julia.ts
Normal file
13
blog/2024-11-15-playing-with-fire/src/julia.ts
Normal file
@ -0,0 +1,13 @@
|
||||
// hidden-start
|
||||
import { Variation } from './variations'
|
||||
// hidden-end
|
||||
export const julia: Variation = (x, y) => {
|
||||
const r = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
|
||||
const theta = Math.atan2(x, y);
|
||||
const omega = Math.random() > 0.5 ? 0 : Math.PI;
|
||||
|
||||
return [
|
||||
r * Math.cos(theta / 2 + omega),
|
||||
r * Math.sin(theta / 2 + omega)
|
||||
]
|
||||
}
|
4
blog/2024-11-15-playing-with-fire/src/linear.ts
Normal file
4
blog/2024-11-15-playing-with-fire/src/linear.ts
Normal file
@ -0,0 +1,4 @@
|
||||
// hidden-start
|
||||
import {Variation} from "./variations"
|
||||
//hidden-end
|
||||
export const linear: Variation = (x, y) => [x, y];
|
97
blog/2024-11-15-playing-with-fire/src/params.ts
Normal file
97
blog/2024-11-15-playing-with-fire/src/params.ts
Normal file
@ -0,0 +1,97 @@
|
||||
/**
|
||||
* Parameters taken from the reference .flame file,
|
||||
* translated into something that's easier to work with.
|
||||
*/
|
||||
|
||||
import { Coefs } from './coefs';
|
||||
import { Transform } from './transform';
|
||||
import { linear } from './linear'
|
||||
import { julia } from './julia'
|
||||
import { popcorn } from './popcorn'
|
||||
import { pdj } from './pdj'
|
||||
|
||||
export const identityCoefs: Coefs = {
|
||||
a: 1, b: 0, c: 0,
|
||||
d: 0, e: 1, f: 0,
|
||||
}
|
||||
|
||||
export const xform1Weight = 0.56453495;
|
||||
export const xform1Coefs = {
|
||||
a: -1.381068, b: -1.381068, c: 0,
|
||||
d: 1.381068, e: -1.381068, f: 0,
|
||||
}
|
||||
export const xform1CoefsPost = identityCoefs;
|
||||
export const xform1Variations = [
|
||||
[1, julia]
|
||||
]
|
||||
export const xform1Color = 0;
|
||||
|
||||
export const xform2Weight = 0.013135;
|
||||
export const xform2Coefs = {
|
||||
a: 0.031393, b: 0.031367, c: 0,
|
||||
d: -0.031367, e: 0.031393, f: 0,
|
||||
}
|
||||
export const xform2CoefsPost = {
|
||||
a: 1, b: 0, c: 0.241352,
|
||||
d: 0, e: 1, f: 0.271521,
|
||||
}
|
||||
export const xform2Variations = [
|
||||
[1, linear],
|
||||
[1, popcorn(xform2Coefs)]
|
||||
]
|
||||
export const xform2Color = 0.844;
|
||||
|
||||
export const xform3Weight = 0.42233;
|
||||
export const xform3Coefs = {
|
||||
a: 1.51523, b: -3.048677, c: 0.724135,
|
||||
d: 0.740356, e: -1.455964, f: -0.362059,
|
||||
}
|
||||
export const xform3CoefsPost = identityCoefs;
|
||||
export const xform3Variations = [
|
||||
[1, pdj(1.09358, 2.13048, 2.54127, 2.37267)]
|
||||
];
|
||||
export const xform3Color = 0.349;
|
||||
|
||||
export const xformFinalCoefs = {
|
||||
a: 2, b: 0, c: 0,
|
||||
d: 0, e: 2, f: 0
|
||||
}
|
||||
export const xformFinalCoefsPost = identityCoefs;
|
||||
export const xformFinalVariations = [
|
||||
[1, julia]
|
||||
]
|
||||
export const xformFinalColor = 0;
|
||||
|
||||
export const palette =
|
||||
"7E3037762C45722B496E2A4E6A2950672853652754632656" +
|
||||
"5C265C5724595322574D2155482153462050451F4E441E4D" +
|
||||
"431E4C3F1E473F1E453F1E433F1E3F3F1E3B3E1E393E1E37" +
|
||||
"421D36431C38451C3A471B3B491B3C4A1A3C4B1A3D4D1A3E" +
|
||||
"4F19405318435517445817465A16475D15495E154960154A" +
|
||||
"65134E6812506B12526E1153711055720F55740F55770E57" +
|
||||
"7A0E59810C58840B58880A588B09588F0858910756930755" +
|
||||
"9A05539D0451A1034FA5024BA90147AA0046AC0045B00242" +
|
||||
"B4043DBB0634BE082EC20A29C30B27C50C26C90F1DCC1116" +
|
||||
"D32110D6280EDA300CDC380ADF4109E04508E24A08E45106" +
|
||||
"E75704EA6402EC6B01EE7300EE7600EF7A00F07E00F18300" +
|
||||
"F29000F29300F39600F39900F39C00F3A000F3A100F3A201" +
|
||||
"F2A502F1A805F0A906EFAA08EEA909EEA80AEDA60CEBA50F" +
|
||||
"E5A313E1A113DD9F13DB9E13D99D14D49C15D09815CC9518" +
|
||||
"C79318BE8B1ABB891BB9871DB4811FB07D1FAB7621A67123" +
|
||||
"9C6227975C289256299053298E502A89482C853F2D803A2E" +
|
||||
"7E3037762C45742B47722B496E2A4E6A2951672853632656" +
|
||||
"5C265C5724595322575022564E2255482153452050451F4E" +
|
||||
"431E4C3F1E473E1D463D1D453F1E43411E413F1E3B3E1E37" +
|
||||
"421D36421D38431D3B451C3A471B3A491B3C4B1A3D4D1A3E" +
|
||||
"4F19405318435418445518455817465A16475D154960154A" +
|
||||
"65134E66124F6812506B12526E1153711055740F55770E57" +
|
||||
"7A0E597E0D57810C58840B58880A588B09588F0858930755" +
|
||||
"9A05539C04529E0452A1034FA5024BA90147AC0045B00242" +
|
||||
"B4043DB7053ABB0634BE0831C20A29C50C26C90F1DCC1116" +
|
||||
"D01711D32110D72A0EDA300CDD390ADF4109E24A08E45106" +
|
||||
"E75704E95F03EA6402EC6C01EE7300EF7A00F07E00F18300" +
|
||||
"F28900F29000F39300F39600F39C00F3A000F3A100F3A201" +
|
||||
"F2A502F2A503F1A805F0A807EFAA08EEA80AEDA60CEBA50F" +
|
||||
"E9A411E5A313E1A113DD9F13D99D14D49C15D09815CC9518" +
|
||||
"C79318C38F1ABE8B1AB9871DB4811FB07D1FAB7621A67123" +
|
||||
"A16A249C6227975E289256298E502A89482C853F2D803A2E"
|
9
blog/2024-11-15-playing-with-fire/src/pdj.ts
Normal file
9
blog/2024-11-15-playing-with-fire/src/pdj.ts
Normal file
@ -0,0 +1,9 @@
|
||||
// hidden-start
|
||||
import { Variation } from './variations'
|
||||
//hidden-end
|
||||
export function pdj(a: number, b: number, c: number, d: number): Variation {
|
||||
return (x, y) => [
|
||||
Math.sin(a * y) - Math.cos(b * x),
|
||||
Math.sin(c * x) - Math.cos(d * y)
|
||||
]
|
||||
}
|
10
blog/2024-11-15-playing-with-fire/src/popcorn.ts
Normal file
10
blog/2024-11-15-playing-with-fire/src/popcorn.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// hidden-start
|
||||
import {Coefs} from './coefs'
|
||||
import {Variation} from './variations'
|
||||
// hidden-end
|
||||
export function popcorn({c, f}: Coefs): Variation {
|
||||
return (x, y) => [
|
||||
x + c * Math.sin(Math.tan(3 * y)),
|
||||
y + f * Math.sin(Math.tan(3 * x))
|
||||
];
|
||||
}
|
9
blog/2024-11-15-playing-with-fire/src/transform.ts
Normal file
9
blog/2024-11-15-playing-with-fire/src/transform.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { Coefs } from './coefs'
|
||||
import { Variation } from './variations'
|
||||
|
||||
export interface Transform {
|
||||
coefs: Coefs,
|
||||
variations: [number, Variation][],
|
||||
coefsPost: Coefs,
|
||||
color: number
|
||||
}
|
1
blog/2024-11-15-playing-with-fire/src/variations.ts
Normal file
1
blog/2024-11-15-playing-with-fire/src/variations.ts
Normal file
@ -0,0 +1 @@
|
||||
export type Variation = (x: number, y: number) => [number, number];
|
Reference in New Issue
Block a user