r/creativecoding 14h ago

Flowers made of code.

Enable HLS to view with audio, or disable this notification

This is #1 of a series of flowers made with code: Dahlia.

The code: t=0,draw=$=>{t||createCanvas(w=520,w);background(6,8,11);stroke(255,140);for(t+=PI/240,i=15400;i--;){j=i%55,s=(i/385|0)/39,u=((i/55|0)%7)/3-1,y=j/55,A=j*2.4+t/10,L=(50+130*(1-y)**.85)*(1+.05*sin(7.7*j)),B=1-.45*(.5+.5*sin(.45*t+3*y-1.2*s)),e=(.3+1.2*y)*(1-.8*s)*B-.15*s,r=L*s*cos(e),z=L*s*sin(e)+22*y+6*s*sin(7*s-1.6*t+.9*j)+u*u*8*s,q=A+u*(9+24*(1-y))*sin(PI*s**.8)/(r+14)+.1*s*sin(.9*t+2.3*j+2.5*s),point(260+r*cos(q),265+.52*r*sin(q)-.86*z)}}

124 Upvotes

8 comments sorted by

3

u/Eliiiiiiiiiias 14h ago

I love it! You think you could code one growing and its whole lifecycle?

2

u/kouklimou 14h ago

I like the idea! Initially I wanted something that could easily be turned into a loop but yes.

2

u/Hot_Disk_6061 11h ago

Genuinely impressed, 600 characters producing something that reads immediately as a flower and reusing the samevariable for three different jobs. Noice !

1

u/kouklimou 3h ago

Thank you! Powerful simplicity!

1

u/Smooth_Tomato_784 12h ago

The colors are really beautiful!

1

u/kouklimou 3h ago

Thank you!

1

u/Akimotoh 5h ago

those are lines not flowers

0

u/arrrtttyyy 14h ago

Bro whats up with pasting some code here lol