PageSourceSearch

https://danielle-honig.com/processing/vines/flower.js

js danielle-honig.com collected 2026-09-24 11:51:40 UTC 1,341 bytes, 45 lines download raw bytes

1/**
2 * sketch for showing a growing flower.
3 *
4 * Copyright 2022 Danielle Honigstein. Free for commercial and personal use with attribution.
5 */
6class Flower {
7  //create new flower at position x,y. Size when done will be 'size' for each petal
8  constructor(x, y, size) {
9    //position of the flower
10    this.x = x;
11    this.y = y;
12    //size of each petal. For this video I used 10 always but
13    //you can play with it
14    this.size = size;
15    //start with 1/10 of the size and grow
16    this.currScale = 0.1;
17    //color of the flower
18    //rate of growth
19
20    this.delta = 0.03;
21    //random pastel like color
22    this.c = color(random(150, 255), random(150, 255), random(150, 255));
23  }
24  //draw, each time increasing the scale by delta until scale = 1;
25  draw() {
26    if (this.currScale <= 1) {
27      //need to push and pop so scales and translations won't get mixed between all the leaves and flowers
28      push();
29      stroke(0);
30      fill(this.c);
31      translate(this.x, this.y);
32      scale(this.currScale);
33      // centre circle
34      ellipse(0, 0, this.size, this.size);
35      // draw 5 petals, rotating after each one
36      for (i = 0; i < 5; i++) {
37        ellipse(0, -this.size, this.size, this.size);
38        rotate(radians(72));
39      }
40      pop();
41      //update scale
42      this.currScale += this.delta;
43    }
44  }
45}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.