lots of zoey's butterflies and flowers
by linzoey
HTML
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/svg.js@latest/dist/svg.min.js"></script>
<a>click here to download this svg!</a>
CSS
body{
background-color:white;
}
JavaScript
var draw = SVG().addTo('body').size(1920, 1080)
function buildArray(n, fillFunction) {
let outputArray = [];
for (let i = 0; i < n; i++) {
outputArray.push(fillFunction(i))
}
return outputArray
}
class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
move(xDistance, yDistance) {
return new Point(this.x + xDistance, this.y + yDistance)
}
}
function randomInteger(min, max) {
return Math.floor(min + ((max - min) * Math.random()))
}
function pick(inputArray) {
return inputArray[randomInteger(0, inputArray.length)]
}
class Butterfly {
constructor(size, tColor, point) {
this.butterflySize = size;
this.butterflyColor = tColor;
this.xPosition = point.x;
this.yPosition = point.y;
this.scaleAmount = undefined;
}
draw() {
this.scaleAmount = 0.6 + Math.random();
let circle2 = draw.circle(60).move(70 + this.xPosition, 70 + this.yPosition).fill(this.butterflyColor).stroke({
width: 1,
color: 'gray'
})
let circle3 = draw.circle(60).move(120 + this.xPosition, 70 + this.yPosition).fill(this.butterflyColor).stroke({
width: 1,
color: 'gray'
})
let circle = draw.circle(70).move(55 + this.xPosition, 10 + this.yPosition).fill(this.butterflyColor).stroke({
width: 1,
color: 'gray'
})
let circle1 = draw.circle(70).move(130 + this.xPosition, 10 + this.yPosition).fill(this.butterflyColor).stroke({
width: 1,
color: 'gray'
})
let circle4 = draw.ellipse(25, 115).move(114 + this.xPosition, 10 + this.yPosition).fill(this.butterflyColor).stroke({
width: 1,
color: 'gray'
})
let line = draw.line(20, 25, 45, 75).move(94 + this.xPosition, -30 + this.yPosition)
line.stroke({
color: 'gray',
width: 1,
linecap: 'round'
})
let line1 = draw.line(50, 75, 70, 25).move(134 + this.xPosition, -30 + this.yPosition)
line1.stroke({
color: 'gray',
width: 1,
linecap: 'round'
...