Revision: 06.08.2023, https://compute.toys/view/407
fn sdSphere(p: vec3f, r: f32) -> f32 {
return length(p) - r;
}| import { suite } from "@thi.ng/bench"; | |
| const w = 640; | |
| const h = 480; | |
| const idata = new ImageData(w, h); | |
| // exposed u8clampedarray | |
| const u8 = idata.data; | |
| // rewrap same memory as u32 | |
| const u32 = new Uint32Array(u8.buffer); |
Revision: 06.08.2023, https://compute.toys/view/407
fn sdSphere(p: vec3f, r: f32) -> f32 {
return length(p) - r;
}This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| package org.ygl.openrndr.demos | |
| import org.openrndr.application | |
| import org.openrndr.color.ColorRGBa | |
| import org.openrndr.color.mix | |
| import org.openrndr.draw.BlendMode | |
| import org.openrndr.draw.DrawPrimitive | |
| import org.openrndr.draw.LineCap | |
| import org.openrndr.draw.VertexElementType | |
| import org.openrndr.draw.renderTarget |
| #!/usr/bin/fish | |
| # You can add this to your ~/.config/fish/config.fish | |
| function __fish_complete_bash | |
| set cmd (commandline -cp) | |
| bash -c "source get-bash-completions.sh; get_completions '$cmd'" | |
| end | |
| # Set the tool to use bash completions |
This post has been moved to my blog, under Color Management in three.js.
The helper function canvas-to-svg.js wraps a given render function (or renderer object) so that you can use Canvas2D context methods as usual, but upon single frame export (with Cmd/Ctrl + S) it will produce both a PNG and SVG file.
This uses canvas2svg which is not a perfect solution, as the Canvas2D API was never designed to be translated to SVG. Its best to stick with simple shape and path operations.
Full instructions: first install the canvas-sketch CLI if you haven't already:
npm install canvas-sketch-cli -g| #!/bin/bash | |
| echo "i am paradox" | |
| #ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4 | |
| # ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4 | |
| # ffmpeg -i audio.mp3 -ignore_loop 0 -i test.gif -vf "scale=trunc(iw/2)*1:trunc(ih/2)*2" -shortest -strict -2 -c:v libx264 -threads 5 -c:a aac -b:a 192k -pix_fmt yuv420p -shortest final.mp4 |
| import React from 'react'; | |
| import { storiesOf } from '@storybook/react'; | |
| import { action } from '@storybook/addon-actions'; | |
| import InlineMonacoEditor from './InlineMonacoEditor'; | |
| export const LINES = [ | |
| 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', | |
| 'Aenean aliquet, nulla eget auctor porttitor, lacus urna', | |
| 'posuere purus, at suscipit orci sapien quis est. Curabitur', |
Here is a script that can be run with canvas-sketch to generate OBJ files from a parametric/algorithmic 3D ThreeJS geometry.
Hitting "Cmd + S" from the canvas-sketch tool will export a PNG and OBJ file of the scene.
If the same script is run from Node, it will simply render the OBJ to stdout, or write to the filename argument if given.