Skip to content

Instantly share code, notes, and snippets.

@essingen123
Created April 11, 2018 09:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save essingen123/19b15ff5083380bf63a7ad911d213104 to your computer and use it in GitHub Desktop.
Save essingen123/19b15ff5083380bf63a7ad911d213104 to your computer and use it in GitHub Desktop.
tendrils
<canvas></canvas>
<!-- Click to generate a new image -->
"use strict";
//////////////////////////////////////////////////////////////////
// Adapted from a CFDG program
// https://www.contextfreeart.org/gallery2/#design/2050
//////////////////////////////////////////////////////////////////
{
const code = {
setup() {
this.render({
startShape: 'TENDRILS',
background: '#fff'
});
},
rules() {
return {
TENDRILS: s => {
this.ARM(s);
this.ARM(s, {flip: 90});
},
ARM: [
98, s => {
this.CIRCLE(s);
this.CIRCLE(s, { size: 0.9, brightness: 1 });
this.ARM(s, { y: 0.2, size: 0.99, rotate: 3 });
},
2, s => {
this.CIRCLE(s);
this.CIRCLE(s, { size: 0.9, brightness: 1 });
this.ARM(s, { y: 0.2, size: 0.99, flip: 90 });
this.ARM(s, { y: 0.2, size: 0.6, brightness: 0.2 });
}
]
};
}
};
// import cfdg library
cfdg.apply(code);
// run code
code.setup();
// Click canvas to generate a new image
["click", "touchdown"].forEach(event => {
document.addEventListener(event, e => code.setup(), false);
});
}
<script src="https://codepen.io/ge1doot/pen/rdeWrK"></script>
html, body {
overflow: hidden;
touch-action: none;
position: absolute;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #000;
}
canvas {
position: absolute;
width: 100%;
height: 100%;
user-select: none;
cursor: pointer;
background: #000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment