sketch_2023_03_31 #Processing #Python #py5 #トゥートProcessing #TootProcessing #generativeArt #creativeCoding

import py5

margin = 60

def setup():
py5.size(800, 800)
py5.no_loop()

def draw():
py5.background(0)
grid(margin, margin, py5.width - margin * 2)

def grid(xo, yo, largura_total, n=3):
w = largura_total / n
color_step = 255 / n
for j in range(n):
x = xo + w * j
for i in range(n):
y = yo + w * i
py5.fill(i * color_step, # red
j * color_step, # green
255 - i * color_step) # blue
if w > 10 and py5.random(9) > 5:
grid(x, y, w)
else:
py5.circle(x + w / 2, y + w / 2, w * 0.98)

def key_pressed():
py5.save_frame('###.png')
redraw()

py5.run_sketch()

setup=_=>createCanvas(480,540)+noStroke()+square(15,15,450, 40)+push()+drawingContext.clip()+background(0)+icon()+pop()+textAlign(CENTER)+textSize(60)+text(TITLE,240,525)

TITLE="Eternal Snow"

function icon(){
S=strokeWeight
stroke(255,99)
for(r=0;r<TAU;r+=PI/3)f(240,240,r,99)}

function f(x,y,r,d){
if((d/=1.4)>2)[1,-1].map(e=>S(d/9)+line(x,y,X=x+cos(R=r+PI/3*e)*d,Y=y+sin(R)*d)+f(X,Y,R,d))}

#トゥートProcessing
#p5icons

#Processing #Python #py5 #genuary #genuary31 #トゥートProcessing

# https://iamkate.com/data/12-bit-rainbow/
palette = (
'#817', '#a35', '#c66', '#e94',
'#ed0', '#9d5', '#4d8', '#2cb',
'#0bc', '#09c', '#36b', '#639'
)

def setup():
size(800, 800)
no_stroke()
background(0)

def draw():
xc = yc = 400
for i in range(6):
m = 1 - abs(cos(radians(frame_count / 2))) ** 5
r = 150 + 150 * m
a = radians(frame_count / 2 + 60 * i)
x = xc + r * cos(a)
y = yc + r * sin(a)
fill(palette[i])
circle(x, y, 150)
r = 300 - 150 * m
a = a + radians(30)
x = xc + r * cos(a)
y = yc + r * sin(a)
fill(palette[-1 -i])
circle(x, y, 150)

The 12-bit rainbow palette

A palette of twelve colours chosen with consideration for how we perceive luminance, chroma, and hue

#Processing #Python #py5 imported mode #genuary #genuary30 #トゥートProcessing
# Kate Rose Morley's palette
# https://iamkate.com/data/12-bit-rainbow/

from itertools import product

palette = (
'#817', '#a35', '#c66', '#e94',
'#ed0', '#9d5', '#4d8', '#2cb',
'#0bc', '#09c', '#36b', '#639'
)

def setup():
global palavras
size(800, 800)
no_loop()
rect_mode(CENTER)
no_stroke()

def draw():
w = 400
i = 0
for x, y in product(range(0, width, w), repeat=2):
for z in range(3):
fill(palette[i])
square(w / 2 + x, w / 2 + y, w / (z / 2 + 1))
i += 1

The 12-bit rainbow palette

A palette of twelve colours chosen with consideration for how we perceive luminance, chroma, and hue

こんな感じでアイコンが並んだらきれいだなって思ったのでまた見切り発車ではじめてみたなう。
#トゥートProcessing
#p5icons

setup=_=>createCanvas(96,116)+noStroke()+square(3,3,90, 15)+push()+drawingContext.clip()+background(0)+icon()+pop()+textAlign(CENTER)+text(TITLE,48,110)

TITLE="Cardioid"

function icon(){
noStroke()
colorMode(HSB)
for(y=0;y<96;y+=14)for(x=y/14%2*7;x<96;x+=14){
fill(random(360),50,100)
beginShape();
for(r=0;r<TAU;r+=.1){
vertex(x+5*(1+cos(r-PI/2))*cos(r)**3,y+5*(1+cos(r-PI/2)*1.5)*sin(r))
}
endShape();
}}
#トゥートProcessing
#p5icons

#sketch_2022_01_25 #Processing #トゥートProcessing #Python #py5 #genuary #genuary25

S = 600
ns = 1

def setup():
size(S, S)
no_stroke()

def draw():
noise_seed(ns)
background(255, 255, 0)
x, f = 8, frame_count
while x < S * 2:
y = 8
while y < S:
M = 16 + 4 * sin(x * 0.05)
h = M * noise(x * 0.01, y * 0.01, f * 0.01) #+ sin(y * 0.005)
fill(0)
circle(x, y, min(M * 0.45, h))
y += min(M * 0.5, h)
x += M * 0.5
fill(255, 255, 0)
rect(0, S - 4, width, 4)

def key_pressed():
global ns
ns += 1

"""
sketch_2022_01_17 #genuary #genuary17 #Python #Processing

Code for #py5 (py5coding.org) imported mode

Recursive grid - I'm always grateful for Takao Shunsuke's inspiration.

#トゥートProcessing #TootProcessing
"""

def setup():
size(1024, 1024)
no_loop()

def draw():
background(0)
grid(0, 0, width, 4)
save_frame('###.png')

def grid(grid_x, grid_y, grid_size, n):
cell_size = grid_size / n
for i in range(n):
x = grid_x + i * cell_size
for j in range(n):
y = grid_y + j * cell_size
if cell_size < 20:
fill(x % 255, 200, y % 255)
circle(x + cell_size / 2,
y + cell_size / 2,
cell_size)
elif n == 1:
fill(0, 0, 200)
square(x, y, cell_size)
else:
next_n = int(random(1, 5))
grid(x, y, cell_size, next_n)

def key_pressed():
redraw()

c=0,draw=$=>{c++?clear(noStroke()):createCanvas(W=600,W,WEBGL),background``,rotateX(-.3),rotateY(c/30),E=ellipsoid,F=fill,l=128,T=$=>translate(0,$),push(F`#7A5`),rotate(.2),T(-135),pop(E(30,8,20)),T(-80),cylinder(3,l),ambientLight(200),pointLight([W],W,-(3*W),2*W),specularMaterial(W),F`#DCB`,T(80),E(99,50,99,l,l),T(80),E(l,50,l,l,l),T(-160),F`#D70`,E(40)};
// #トゥートProcessing  
c=0;draw=_=>{c++?noStroke(rotateX(-.7)):createCanvas(W=600,W,WEBGL);B=box,P=pointLight,T=translate,P([W],0,-300,800),lightFalloff(.4,.001,0),Z=200,S=sin(t=c/20),I=abs(S+abs(S))*10,T(0,60-I*3),fill`#F00`,B(x=Z-I,y=Z+I,x),push(fill`#2D2`),T(0,-y/2),B(x,5,40),T(0,y/2,5),pop(B(40-I/5,y+5,x)),T(0,I*3-x/2),specularMaterial` #トゥートProcessing #Xmas #Happy Holidays`,P(Z,Z,0,0,400),rotateY(c/Z),cone(700,1e3)}