lean-ja / lean-ja/lean-by-example
`widget_module` で p5js を使用するウィジェットを自作する
Open
Nobody has claimed this yet.
コード例
属性
- Dominant language
- Lean
- Stars
- 188
- Forks
- 15
- Avg merge
- 9h 8m
- Merged PRs (30d)
- 6
Description
ProofWidgets4 の作者に教えていただいた例
import Lean
open Lean Widget
@[widget_module]
def P5Widget : Widget.Module where
javascript := "
import * as React from 'react'
import p5 from 'https://esm.sh/p5'
function sketch(p5) {
p5.setup = () => {
p5.createCanvas(600, 400, p5.WEBGL);
};
p5.draw = () => {
p5.background(250);
p5.normalMaterial();
p5.push();
p5.rotateZ(p5.frameCount * 0.01);
p5.rotateX(p5.frameCount * 0.01);
p5.rotateY(p5.frameCount * 0.01);
p5.plane(100);
p5.pop();
};
}
export default function() {
React.useEffect(() => {
new p5(sketch, 'p5sketch')
}, [])
return React.createElement('div', { id: 'p5sketch' })
}
"
#widget P5Widget
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating where Lean widget examples are stored and how widget_module examples are presented. Review the issue's P5Widget snippet and verify whether the repository should include it as a runnable example; done means the p5js-based widget can be found and used successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100