mirror of
https://github.com/bspeice/speice.io
synced 2024-12-22 16:48:10 -05:00
Fix initial posts to use the new painter API
This commit is contained in:
parent
112470ce5a
commit
f327b53863
16
blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx
Normal file
16
blog/2024-11-15-playing-with-fire/1-introduction/Gasket.tsx
Normal file
@ -0,0 +1,16 @@
|
||||
import Canvas, {PainterContext} from "../src/Canvas";
|
||||
import {useContext} from "react";
|
||||
|
||||
export function Render({f}) {
|
||||
const {setPainter} = useContext(PainterContext);
|
||||
setPainter(f);
|
||||
return <></>;
|
||||
}
|
||||
|
||||
export default function Gasket({f}) {
|
||||
return (
|
||||
<Canvas width={500} height={500}>
|
||||
<Render f={f}/>
|
||||
</Canvas>
|
||||
)
|
||||
}
|
@ -27,10 +27,4 @@ function* chaosGame() {
|
||||
}
|
||||
|
||||
// Wiring so the code above displays properly
|
||||
function Gasket() {
|
||||
const {setPainter} = useContext(PainterContext);
|
||||
setPainter(chaosGame());
|
||||
|
||||
return (<></>)
|
||||
}
|
||||
render(<Gasket/>)
|
||||
render(<Gasket f={chaosGame()}/>)
|
||||
|
@ -177,9 +177,7 @@ import Scope from './scope'
|
||||
|
||||
import chaosGameSource from '!!raw-loader!./chaosGame'
|
||||
|
||||
<!--
|
||||
<Playground scope={Scope} noInline={true}>{chaosGameSource}</Playground>
|
||||
-->
|
||||
|
||||
<hr/>
|
||||
|
||||
|
@ -1,15 +1,12 @@
|
||||
import {useContext} from "react";
|
||||
import Gasket from "./Gasket";
|
||||
import { plot } from './plot';
|
||||
import { randomBiUnit } from '../src/randomBiUnit';
|
||||
import { randomInteger } from '../src/randomInteger';
|
||||
import Canvas, {PainterContext} from "../src/Canvas";
|
||||
|
||||
const Scope = {
|
||||
Canvas,
|
||||
PainterContext,
|
||||
Gasket,
|
||||
plot,
|
||||
randomBiUnit,
|
||||
randomInteger,
|
||||
useContext,
|
||||
}
|
||||
export default Scope;
|
Loading…
Reference in New Issue
Block a user