After installing canvas-sketch globally, create a new folder to hold your sketch:
mkdir my-sketch
cd my-sketch
Now run the following to generate a new default .ts
file, package.json
, etc:
// From the book: Graphics Shaders | |
vec3 CMYKtoRGB (vec4 cmyk) { | |
float c = cmyk.x; | |
float m = cmyk.y; | |
float y = cmyk.z; | |
float k = cmyk.w; | |
float invK = 1.0 - k; | |
float r = 1.0 - min(1.0, c * invK + k); |
After installing canvas-sketch globally, create a new folder to hold your sketch:
mkdir my-sketch
cd my-sketch
Now run the following to generate a new default .ts
file, package.json
, etc:
// Taken From: | |
// https://stackoverflow.com/questions/849211/shortest-distance-between-a-point-and-a-line-segment | |
function sqr (x) { | |
return x * x; | |
} | |
function dist2 (v, w) { | |
return sqr(v[0] - w[0]) + sqr(v[1] - w[1]); | |
} |
Meridian is a generative art project deployed on Ethereum, and distributed as unique, artist-signed tokens. This creates an interesting scenario where the value and acquisition of the art project is not tied to the scarcity of access to its media (such as high-resolution PNGs and fine art prints of the algorithm's output). And so, I've created some tools to help all audiences—whether collectors of the tokens or not—export high-resolution outputs of a given Meridian for personal and non-commercial means. For example: fine art printing to hang a Meridian on your walls, or using it as a social media avatar or banner, or including it in a blog post.
First, open the following page and scroll to the interactive component, showing the Meridian software: https://meridian.mattdesl.com/
In that page, open your DevTools Console in the browser, in Chrome it is under View > Developer > JavaScript Console. Each time you click the artwork, it
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.Input.Keys; | |
import com.badlogic.gdx.InputAdapter; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.graphics.Color; | |
import com.badlogic.gdx.graphics.GL10; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
import com.badlogic.gdx.graphics.Pixmap.Format; | |
import com.badlogic.gdx.graphics.Texture; |
function loadImage(url, callback) { | |
var image = new Image(); | |
image.onload = function() { | |
callback(null, image); | |
}; | |
image.onerror = function() { | |
callback(new Error('Could not load image at ' + url)); | |
}; | |
image.src = url; | |
} |
mostly in the realm of creative coding and graphics programming
lots of these are my own :)
https://www.npmjs.org/package/wzrd (browserify dev server)
https://www.npmjs.org/package/budo (like wzrd but with incremental watching & LiveReload)
https://www.npmjs.org/package/beefy (more fully-featured dev server)
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL10; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
import com.badlogic.gdx.graphics.Pixmap.Format; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.SpriteBatch; | |
import com.badlogic.gdx.graphics.g2d.TextureRegion; |
/* | |
Copyright 2018 Matt DesLauriers | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE |
import com.badlogic.gdx.ApplicationListener; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplication; | |
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; | |
import com.badlogic.gdx.graphics.GL10; | |
import com.badlogic.gdx.graphics.OrthographicCamera; | |
import com.badlogic.gdx.graphics.Pixmap.Format; | |
import com.badlogic.gdx.graphics.Texture.TextureFilter; | |
import com.badlogic.gdx.graphics.Texture; | |
import com.badlogic.gdx.graphics.g2d.BitmapFont; |