JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.

Any URL's added here will be added as `<script>`

s in order, and run *before* the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

` ````
html, body {
margin: 0;
padding: 0;
}
canvas {
width: 500px;
height: 500px;
max-width: 100vw;
max-height: 100vh;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 2px solid #8DA5B2;
z-index: 0;
}
.dg.ac {
z-index: 100 !important;
position: absolute;
}
```

` ````
var gui = new dat.GUI({closed:true});
var settings = {
skyColor: "#81bfe8",
treeColor: "#00ff00",
lightColor: "#ff9900",
slowness: 1000,
zSize: 1000
}
gui.add(settings, "zSize", 10, 2000);
gui.add(settings, "slowness", 500,10000);
gui.addColor(settings, "skyColor");
gui.addColor(settings, "treeColor");
gui.addColor(settings, "lightColor");
function setup() {
createCanvas(windowWidth, windowHeight, WEBGL)
// X VARS
xCount = 7;
xWidth = windowWidth / xCount;
xRadius = xWidth/2;
// Y VARS
yRadius = dist(0,0,-xRadius,-xRadius/2);
yHeight = yRadius*2;
yCount = windowHeight / xRadius;
}
function draw() {
background(settings.skyColor);
// ROTATION
rotateX(PI/2.6)
// rotateY(millis() / 10000)
rotateZ(millis() / 10000)
// LIGHTS
ambientLight(100);
specularMaterial(settings.treeColor);
pointLight(color(settings.lightColor), width*1, -height*2, -20);
noStroke();
var modifier = norm(sin(millis()/settings.slowness), -1, 1);
for ( var x = 0; x <= xCount; x++ ){
for ( var y = 0; y <= yCount; y++ ) {
var xPos = (xWidth * x) - (width/2),
yPos = (y - (yCount / 2)) * xWidth;
if ( y % 2 ) { xPos += xRadius; }
var distanceFromCenter = dist(xPos, yPos, 0, 0),
percentageOfScreenAway = distanceFromCenter/(Math.max(width, height)/2),
currentZSize = constrain(settings.zSize * (1-percentageOfScreenAway), 0, settings.zSize),
z = (settings.zSize * modifier)/5,
x1 = xPos + (cos(radians(30)) * yRadius),
y1 = yPos + (sin(radians(30)) * yRadius),
x2 = xPos + (cos(radians(90)) * yRadius),
y2 = yPos + (sin(radians(90)) * yRadius),
x3 = xPos + (cos(radians(150)) * yRadius),
y3 = yPos + (sin(radians(150)) * yRadius),
x4 = xPos + (cos(radians(210)) * yRadius),
y4 = yPos + (sin(radians(210)) * yRadius),
x5 = xPos + (cos(radians(270)) * yRadius),
y5 = yPos + (sin(radians(270)) * yRadius),
x6 = xPos + (cos(radians(330)) * yRadius),
y6 = yPos + (sin(radians(330)) * yRadius);
// 1 - 2
beginShape()
vertex(x1, y1, 0);
vertex(x2, y2, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
// 2 - 3
beginShape()
vertex(x2, y2, 0);
vertex(x3, y3, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
// 3 - 4
beginShape()
vertex(x3, y3, 0);
vertex(x4, y4, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
// 4 - 5
beginShape()
vertex(x4, y4, 0);
vertex(x5, y5, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
// 5 - 6
beginShape()
vertex(x5, y5, 0);
vertex(x6, y6, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
// 6 - 1
beginShape()
vertex(x6, y6, 0);
vertex(x1, y1, 0);
vertex(xPos, yPos, z);
endShape(CLOSE);
}
}
}
```

999px

Shift F
Opt F
Find & Replace

Also see: Tab Triggers