go-p5 / p5 Goto Github PK
View Code? Open in Web Editor NEWp5 is a simple package that provides primitives resembling the ones exposed by p5js.org
Home Page: https://go-p5.github.io/
License: BSD 3-Clause "New" or "Revised" License
p5 is a simple package that provides primitives resembling the ones exposed by p5js.org
Home Page: https://go-p5.github.io/
License: BSD 3-Clause "New" or "Revised" License
with Gio>=v0.0.0-20210729070555-8cec7e04eb71
there appears to be a slight graphical hiccups when comparing an image produced with or w/o the libGL s/w renderer (the GitHubActions CI test on Linux falls back on using libGL s/w renderer.)
see:
reference: https://p5js.org/reference/#/p5/frameCount
saveFrames
I looked for it in the documentation but it's not there so I guess not
I am trying to run locally the test suite but it fails due to existing delta of 0.05
=== RUN TestAPIShapes
api_test.go:61: testdata/api_shapes.png: images compare different
--- FAIL: TestAPIShapes (0.08s)
Increasing delta to 0.06 make test green.
Is there any other more robust way to implement tests avoiding image comparison completely? Is there a way to compare the state that produces the images instead of the images themselves?
we should implement more of the p5js API:
path
rotate
scale
transform
push/pop
bézier
curve
frame-rate
resize-canvas
vector (just use gonum.org/v1/gonum/spatial/r2.Vec
)
image loading, image display
keyboard callbacks
in Processing and in p5js, the state of the display is retained from iteration to iteration.
right now, in p5, we don't (so, for example, in the mouse-pressed
example, the circle around the mouse follows the mouse but doesn't leave a trail of circles across its path, as the p5js example does.)
that's actually a feature of Gio.
to "simulate" the same behaviour, we could have an image.Image
field that is drawn to at the end of each draw
cycle.
at cycle+1, we draw that last image.Image
before invoking the user's draw
function.
There is an error on documentation on what a simple example using the library should look like, on line 20 the use of Square function has one argument more than it is required located on p5.go
file:
p5.Square(10, 10, 50, 50)
desc of what target is eg user per week
right now, p5 relies on Gio to get its re-draw events, together with a little ticker goroutine (that ticks at the requested frequency, requesting Gio for redrawing the canvas).
it's a bit brittle because it's intertwined with other Gio events that will re-draw the canvas (such as a resize of the window), which will confuse users' draw
methods (e.g.: the current solar-system
draw
methods expects a fixed frequency and computes delta-t (and thus positions, speeds and accelerations) from that frequency).
we'd need to somehow separate or distinguish the 2 sets of events. (probably by only re-drawing when the ticker goroutine marked some Proc state as "dirty"?)
I am trying to use p5.Rect(382.732615, 14.503678, 52.000000, 73.000000)
, but it is returning the following error:
"not all path contours are closed"
Probably an skill issue, but can anybody help me?
Currently the is no way to control the execution of Proc draw loop since it is handled by events received by a receive only channel (<-chan event.Event)
Line 208 in fea8ed5
Providing a way to send events and control/stop the loop would make Proc more testable.
Add Random and RandomSeed methods, similar to https://p5js.org/reference/#/p5/random and https://p5js.org/reference/#/p5/randomSeed
right now, p5.Proc
takes a width and a height in pixels to set the canvas size.
but we should fine a way to map these dimensions to "physical" dimensions (ex: "U.A" or "km" for the solar system example) so users can just reason in their problem space.
internally, p5.Proc
has already the logic to convert from "user" space coordinates to "system" coordinates.
Changes in calls to Outline and Stroke prevent go-p5 from compiling.
https://lists.sr.ht/~eliasnaur/gio-patches/patches/15848
https://p5js.org/reference/#/p5/frameRate
Currently the is no way to override the default ticker, so there is no way to change the frame rate.
One solution would be to reset the ticker using https://golang.org/pkg/time/#Ticker.Reset whenever there is an update to Proc.ctl.FrameRate().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.