This small project was for COMP1202 Programming 1 at the University of Southampton end of Christmas term challenge.
It does what it says on the tin and generates snowflakes in SVG form.
Lots and lots of trig.
- Generates a random number of sub branches and a random length for each sub branch
- Generates random stroke sizes for the main branches and a random stroke for each sub branch
- Uses lots of trigonometry to draw out all of the lines
- Actually draws each line in relation to the SVG
This snowflake generator served as my initial inspiration and you can probably see the similarities. I tried looking for the source code but couldn't find anything so I ended up just using it for design inspiration. Their solution was quite basic so I developed on it further.
This codegolf solution generates snowflakes using only 190 bytes of HTML and JavaScript which was very impressive.
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository