py5coding on Nostr: Creating 10_000 of something is easy with #py5's vectorized methods. Here, the ...
Creating 10_000 of something is easy with #py5's vectorized methods. Here, the `vertices()` and `set_strokes()` methods are used to quickly create and color 10_000 points.
size(999, 999, P2D)
color_mode(CMAP, "hot")
stroke_weight(32)
s = create_shape()
with s.begin_shape(POINTS):
s.vertices(999 * np.random.rand(N:=10000, 2))
s.set_strokes(color(x / N, 64)for x in range(N))
shape(s)
#processing #genuary #genuary16
Published at
2024-01-16 22:18:39Event JSON
{
"id": "7997001dedf0f4484cc010dc7f0cbe04d236e8f8568d92d473a7a35d3eb7e338",
"pubkey": "84ee38e8a3fd005f79ad54ce399885a0a0493f3345fcfcdd92353994b25bc89b",
"created_at": 1705443519,
"kind": 1,
"tags": [
[
"t",
"py5"
],
[
"t",
"processing"
],
[
"t",
"GENUARY"
],
[
"t",
"genuary16"
],
[
"proxy",
"https://fosstodon.org/users/py5coding/statuses/111767946524011243",
"activitypub"
]
],
"content": "Creating 10_000 of something is easy with #py5's vectorized methods. Here, the `vertices()` and `set_strokes()` methods are used to quickly create and color 10_000 points.\n\nsize(999, 999, P2D)\ncolor_mode(CMAP, \"hot\")\nstroke_weight(32)\ns = create_shape()\nwith s.begin_shape(POINTS):\n s.vertices(999 * np.random.rand(N:=10000, 2))\ns.set_strokes(color(x / N, 64)for x in range(N))\nshape(s)\n\n#processing #genuary #genuary16\n\nhttps://cdn.fosstodon.org/media_attachments/files/111/767/938/319/910/337/original/826004d3599a17eb.png",
"sig": "5d5936163d8660b1284283694f9b07f9b242e3412841ef91e1b627f80637d3a8b0931a048e1e6872962b2426d91ad4cdfddcf92aac03cb4b38b40624b3bffab6"
}