From b08c78257bd61ef38e654efbbc38934b9cd9d979 Mon Sep 17 00:00:00 2001 From: osbm Date: Thu, 31 Oct 2024 14:20:19 +0300 Subject: [PATCH] save current progress --- public/scripts/hello-world.js | 8 ++++++++ public/scripts/input-output.js | 32 +++++++++++++++++++++++++++++ src/components/P5Sketch.astro | 32 +++++++++++++++++++++++++++++ src/content/blog/blog-with-p5js.mdx | 20 ++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 public/scripts/hello-world.js create mode 100644 public/scripts/input-output.js create mode 100644 src/components/P5Sketch.astro create mode 100644 src/content/blog/blog-with-p5js.mdx diff --git a/public/scripts/hello-world.js b/public/scripts/hello-world.js new file mode 100644 index 0000000..77a5100 --- /dev/null +++ b/public/scripts/hello-world.js @@ -0,0 +1,8 @@ +function setup() { + let mycanvas = createCanvas(400, 400); + mycanvas.parent('hello-world'); +} +function draw() { + fill(255); + ellipse(mouseX, mouseY, 80, 80); +} \ No newline at end of file diff --git a/public/scripts/input-output.js b/public/scripts/input-output.js new file mode 100644 index 0000000..044fc81 --- /dev/null +++ b/public/scripts/input-output.js @@ -0,0 +1,32 @@ +function setup() { + let canvas = createCanvas(710, 400, WEBGL); + canvas.parent('input-output'); + angleMode(DEGREES); + strokeWeight(5); + noFill(); + stroke(32, 8, 64); +} + +function draw() { + background(250, 180, 200); + + // Call every frame to adjust camera based on mouse/touch + orbitControl(); + + // Rotate rings in a half circle to create a sphere of cubes + for (let zAngle = 0; zAngle < 180; zAngle += 30) { + // Rotate cubes in a full circle to create a ring of cubes + for (let xAngle = 0; xAngle < 360; xAngle += 30) { + push(); + + // Rotate from center of sphere + rotateZ(zAngle); + rotateX(xAngle); + + // Then translate down 400 units + translate(0, 400, 0); + box(); + pop(); + } + } +} \ No newline at end of file diff --git a/src/components/P5Sketch.astro b/src/components/P5Sketch.astro new file mode 100644 index 0000000..46a1ff2 --- /dev/null +++ b/src/components/P5Sketch.astro @@ -0,0 +1,32 @@ +--- +const { sketch_path, sketch_name, figure_id, sketch_description } = Astro.props; +// https://github.com/osbm/osbm.dev/blob/main/ + sketch_path(first 3 characters removed) +const sketch_url = 'https://github.com/osbm/osbm.dev/blob/main/' + sketch_path.slice(3); + +--- + + + + +
+ +
+

Figure {figure_id}: {sketch_description} Sketch source + +

+ \ No newline at end of file diff --git a/src/content/blog/blog-with-p5js.mdx b/src/content/blog/blog-with-p5js.mdx new file mode 100644 index 0000000..d5f3fc7 --- /dev/null +++ b/src/content/blog/blog-with-p5js.mdx @@ -0,0 +1,20 @@ +--- +title: 'Second post' +description: 'First post of this website that tests many things' +pubDate: '2024-10-26' + + +--- +import P5Sketch from '../../components/P5Sketch.astro'; + + +Before Canvas + + + +After canvas + + + + +why these things happen \ No newline at end of file