Skip to content

Commit

Permalink
Merge pull request #40 from ff6347/feat/startercode
Browse files Browse the repository at this point in the history
feat(startercode): Add new starter code
ff6347 authored Nov 22, 2023
2 parents 25b6025 + e1942de commit d2c1bb0
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -11,15 +11,32 @@ import Sandbox from "../components/Sandbox.tsx";
disableStorage={false}
initialCode={`
//@ts-check
function setup(){
const canvas = createCanvas(100,100);
canvas.parent("sketch");
background(0);
let ff6347 = '#ff6347';
let complementaryColor;
function setup() {
const canvas = createCanvas(100, 100);
colorMode(HSB, 360, 100, 100, 100);
canvas.parent('sketch');
const bg = color(360);
console.log(bg);
background(bg);
complementaryColor = color(
(hue(ff6347) + 180) % 360,
saturation(ff6347),
brightness(ff6347)
);
}
function draw(){
circle((1/sqrt(random())*50) - width/2,
random(height),
random(4))
function draw() {
if (frameCount % 2) {
fill(ff6347);
} else {
fill(complementaryColor);
}
circle(
(1 / sqrt(random())) * 50 - width / 2,
random(height),
random(4)
);
}
`}
client:only

0 comments on commit d2c1bb0

Please sign in to comment.