File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ export default function ParticleLifePage() {
4141 const [ fps , setFps ] = useState ( 0 )
4242 const [ workers ] = useState ( ( ) => Math . max ( 1 , navigator . hardwareConcurrency - 1 ) )
4343 const [ formatter ] = useState ( ( ) => new Intl . NumberFormat ( undefined , { maximumFractionDigits : 0 , minimumIntegerDigits : 3 } ) )
44+ const [ initialWeights ] = useState ( ( ) => {
45+ const weights = new Array ( COLORS . length * COLORS . length )
46+ for ( let i = 0 ; i < weights . length ; i ++ ) {
47+ weights [ i ] = ( Math . random ( ) * 2 - 1 ) . toFixed ( 2 )
48+ }
49+ return weights
50+ } )
4451
4552 useEffect ( ( ) => {
4653 const form = formRef . current !
@@ -243,9 +250,14 @@ export default function ParticleLifePage() {
243250 </ th >
244251 { Array . from ( { length : colors } ) . map ( ( _ , j ) => (
245252 < td key = { j } >
246- < input type = "number" name = { `attraction_${ i } _${ j } ` } defaultValue = { i === j ? "1" : "0" } step = "0.1" min = "-1" max = "1" />
253+ < input type = "number" name = { `attraction_${ i } _${ j } ` } defaultValue = { initialWeights [ i * COLORS . length + j ] } step = "0.1" min = "-1" max = "1" />
247254 </ td >
248255 ) ) }
256+ { /* {Array.from({ length: colors }).map((_, j) => (
257+ <td key={j}>
258+ <input type="number" name={`attraction_${i}_${j}`} defaultValue={i === j ? "1" : "0"} step="0.1" min="-1" max="1" />
259+ </td>
260+ ))} */ }
249261 </ tr >
250262 ) ) }
251263 </ tbody >
Original file line number Diff line number Diff line change @@ -235,7 +235,7 @@ export const ROUTES = {
235235 tags : [ 'simulation' , 'canvas' , 'particles' ] ,
236236 } ,
237237 git : {
238- lastModified : 1762271198000 ,
238+ lastModified : 1762282622000 ,
239239 firstAdded : 1760880322000
240240 } ,
241241 } ,
You can’t perform that action at this time.
0 commit comments