Rhossolas
1月15日
import random
import math
particles = []
fireworks = []
buildings = []
click_count = 0
mega_firework = None
mega_particles = []
show_message = False
message_timer = 0
class Particle:
def \__init_\_(self, x, y, color, size_multiplier=1, velocity_multiplier=1):
self.x = x
self.y = y
self.vx = random.uniform(-4, 4) \* velocity_multiplier
self.vy = random.uniform(-4, 4) \* velocity_multiplier
self.color = color
self.life = 255
self.max_life = 255
self.size = random.uniform(3, 8) \* size_multiplier
def update(self):
self.x += self.vx
self.y += self.vy
self.vy += 0.15 # 重力
self.vx \*= 0.97 # 空气阻力
self.life -= 2.5 # 3-4秒内淡出
def draw(self):
if self.life > 0:
pushStyle()
# 添加发光效果
for i in range(3):
glow_size = self.size + i \* 2
glow_alpha = self.life \* (0.3 - i \* 0.1)
fill(red(self.color), green(self.color), blue(self.color), glow_alpha)
noStroke()
ellipse(self.x, self.y, glow_size, glow_size)
# 核心粒子
fill(255, 255, 255, self.life) # 白色核心
ellipse(self.x, self.y, self.size \* 0.5, self.size \* 0.5)
popStyle()
class Firework:
def \__init_\_(self, x, y, is_mega=False):
self.x = x
self.y = y
self.start_y = height
self.y_pos = self.start_y
self.exploded = False
self.is_mega = is_mega
if is_mega:
self.color = color(255, 255, 255) # 白色,后面会添加多种颜色
else:
# 每个烟花随机颜色
hue = random.random()
if hue < 0.2:
self.color = color(255, 100, 100) # 红色
elif hue < 0.4:
self.color = color(100, 255, 100) # 绿色
elif hue < 0.6:
self.color = color(100, 100, 255) # 蓝色
elif hue < 0.8:
self.color = color(255, 255, 100) # 黄色
else:
self.color = color(255, 100, 255) # 紫色
def update(self):
if not self.exploded:
speed = 6 if self.is_mega else 8
self.y_pos -= speed
if self.y_pos <= self.y:
self.explode()
self.exploded = True
def explode(self):
particle_count = 200 if self.is_mega else 50
for i in range(particle_count):
angle = random.uniform(0, TWO_PI)
speed = random.uniform(2, 8)
px = self.x + cos(angle) \* speed
py = self.y + sin(angle) \* speed
if self.is_mega:
# 超大烟花使用多种颜色
colors = \[
color(255, 0, 0), color(0, 255, 0), color(0, 0, 255),
color(255, 255, 0), color(255, 0, 255), color(0, 255, 255),
color(255, 165, 0), color(255, 255, 255)
\]
particle_color = random.choice(colors)
size_multiplier = 1.5
velocity_multiplier = 1.3
else:
particle_color = self.color
size_multiplier = 1
velocity_multiplier = 1
particles.append(Particle(px, py, particle_color, size_multiplier, velocity_multiplier))
def draw(self):
if not self.exploded:
pushStyle()
# 火箭尾部发光效果
for i in range(3):
glow_size = 6 - i
glow_alpha = 200 - i \* 50
fill(red(self.color), green(self.color), blue(self.color), glow_alpha)
noStroke()
ellipse(self.x, self.y_pos + i \* 3, glow_size, glow_size)
popStyle()
class Building:
def \__init_\_(self, x, width, height):
self.x = x
self.width = width
self.height = height
self.windows = \[\]
self.generate_windows()
def generate_windows(self):
# 生成窗户,随机一些亮着
window_rows = self.height // 40
window_cols = self.width // 30
for row in range(window_rows - 1): # 留一层不要窗户
for col in range(window_cols - 1): # 留边距
if random.random() > 0.3: # 70%的概率有窗户
is_lit = random.random() > 0.4 # 60%的概率亮着
window_x = self.x + col \* 30 + 15
window_y = height - self.height + row \* 40 + 20
self.windows.append({
'x': window_x,
'y': window_y,
'lit': is_lit
})
def draw(self):
# 建筑剪影
fill(0, 15, 8)
rect(self.x, height - self.height, self.width, self.height)
# 窗户
for window in self.windows:
if window\['lit'\]:
fill(255, 255, 150, 200) # 亮黄色灯光
else:
fill(20, 25, 35) # 暗色,与背景相近
noStroke()
rect(window\['x'\], window\['y'\], 15, 20)
def setup():
size(800, 600)
background(20, 25, 40)
# 初始化建筑
buildings_data = \[
(100, 80, 200),
(250, 60, 150),
(400, 70, 180),
(550, 50, 120),
(680, 90, 160)
\]
for x, w, h in buildings_data:
buildings.append(Building(x, w, h))
def draw():
global mega_firework, show_message, message_timer
# 绘制夜晚背景
draw_background()
# 绘制建筑
for building in buildings:
building.draw()
# 更新和绘制烟花
for firework in fireworks\[:\]:
firework.update()
firework.draw()
if firework.exploded and firework.y_pos <= firework.y:
fireworks.remove(firework)
# 更新和绘制超大烟花
if mega_firework:
mega_firework.update()
mega_firework.draw()
if mega_firework.exploded and mega_firework.y_pos <= mega_firework.y:
mega_firework = None
show_message = True
message_timer = 300 # 5秒 (60fps \* 5)
# 更新和绘制粒子
for particle in particles\[:\]:
particle.update()
particle.draw()
if particle.life <= 0:
particles.remove(particle)
# 更新和绘制超大粒子
for particle in mega_particles\[:\]:
particle.update()
particle.draw()
if particle.life <= 0:
mega_particles.remove(particle)
# 显示消息
if show_message:
draw_message()
message_timer -= 1
if message_timer <= 0:
show_message = False
# 绘制文字
draw_text()
def draw_background():
# 深蓝天色渐变
for i in range(height):
inter = map(i, 0, height, 0, 1)
c = lerpColor(color(20, 25, 40), color(10, 15, 30), inter)
stroke(c)
line(0, i, width, i)
# 绘制星星
fill(255, 255, 200, 150)
noStroke()
for i in range(50):
x = (i \* 137.5 + frameCount \* 0.1) % width
y = (i \* 89) % (height // 2)
size = sin(frameCount \* 0.05 + i) \* 2 + 3
ellipse(x, y, size, size)
# 绘制地面
fill(0, 20, 10)
beginShape()
vertex(0, height)
vertex(0, height - 100)
for x in range(0, width, 50):
y = height - 100 + sin(x \* 0.01) \* 20
vertex(x, y)
vertex(width, height - 100)
vertex(width, height)
endShape(CLOSE)
def draw_message():
pushStyle()
textAlign(CENTER, CENTER)
textSize(64)
# 彩虹渐变文字
colors = \[
color(255, 0, 0), color(255, 165, 0), color(255, 255, 0),
color(0, 255, 0), color(0, 0, 255), color(75, 0, 130), color(238, 130, 238)
\]
text_width = textWidth("Happy New Year!")
char_width = text_width / len("Happy New Year!")
for i, char in enumerate("Happy New Year!"):
color_index = int((i / len("Happy New Year!")) \* len(colors))
fill(colors\[color_index % len(colors)\])
x = width/2 - text_width/2 + i \* char_width
text(char, x, height/2)
popStyle()
def draw_text():
pushStyle()
textAlign(CENTER, CENTER)
textSize(48)
fill(255, 215, 0) # 金色
text("Happy New Year", width/2, 80)
textSize(24)
fill(255, 182, 193) # 粉色
text("2026", width/2, 120)
textSize(16)
fill(200, 200, 255, 200)
text("Click left mouse button to launch fireworks", width/2, height - 30)
# 显示点击计数
textSize(14)
text("Clicks: " + str(click_count), 60, height - 30)
popStyle()
def mousePressed():
global click_count, mega_firework
if mouseButton == LEFT:
click_count += 1
# 每26次点击触发彩蛋
if click_count % 26 == 0:
mega_firework = Firework(width/2, height/2, is_mega=True)
else:
fireworks.append(Firework(mouseX, mouseY))
Rhossolas
1月8日
import random
import math
particles = []
fireworks = []
class Particle:
def \__init_\_(self, x, y, color):
self.x = x
self.y = y
self.vx = random.uniform(-3, 3)
self.vy = random.uniform(-3, 3)
self.color = color
self.life = 255
self.max_life = 255
self.size = random.uniform(2, 6)
def update(self):
self.x += self.vx
self.y += self.vy
self.vy += 0.1 # 重力
self.vx \*= 0.98 # 空气阻力
self.life -= 3 # 3秒内淡出
def draw(self):
if self.life > 0:
pushStyle()
fill(red(self.color), green(self.color), blue(self.color), self.life)
noStroke()
ellipse(self.x, self.y, self.size, self.size)
popStyle()
class Firework:
def \__init_\_(self, x, y):
self.x = x
self.y = y
self.start_y = height
self.y_pos = self.start_y
self.exploded = False
self.color = color(random.randint(100, 255), random.randint(100, 255), random.randint(100, 255))
def update(self):
if not self.exploded:
self.y_pos -= 8
if self.y_pos <= self.y:
self.explode()
self.exploded = True
def explode(self):
# 创建爆炸粒子
for i in range(50):
angle = random.uniform(0, TWO_PI)
speed = random.uniform(1, 6)
px = self.x + cos(angle) \* speed
py = self.y + sin(angle) \* speed
particles.append(Particle(px, py, self.color))
def draw(self):
if not self.exploded:
pushStyle()
fill(red(self.color), green(self.color), blue(self.color))
noStroke()
ellipse(self.x, self.y_pos, 4, 4)
popStyle()
def setup():
size(800, 600)
background(20, 25, 40)
def draw():
# 绘制夜晚背景
draw_background()
# 更新和绘制烟花
for firework in fireworks\[:\]:
firework.update()
firework.draw()
if firework.exploded and firework.y_pos <= firework.y:
fireworks.remove(firework)
# 更新和绘制粒子
for particle in particles\[:\]:
particle.update()
particle.draw()
if particle.life <= 0:
particles.remove(particle)
# 绘制新年文字
draw_text()
def draw_background():
# 深蓝天色渐变
for i in range(height):
inter = map(i, 0, height, 0, 1)
c = lerpColor(color(20, 25, 40), color(10, 15, 30), inter)
stroke(c)
line(0, i, width, i)
# 绘制星星
fill(255, 255, 200, 150)
noStroke()
for i in range(50):
x = (i \* 137.5 + frameCount \* 0.1) % width
y = (i \* 89) % (height // 2)
size = sin(frameCount \* 0.05 + i) \* 2 + 3
ellipse(x, y, size, size)
# 绘制地面剪影
fill(0, 20, 10)
beginShape()
vertex(0, height)
vertex(0, height - 100)
for x in range(0, width, 50):
y = height - 100 + sin(x \* 0.01) \* 20
vertex(x, y)
vertex(width, height - 100)
vertex(width, height)
endShape(CLOSE)
# 绘制建筑物剪影
fill(0, 15, 8)
rect(100, height - 200, 80, 200)
rect(250, height - 150, 60, 150)
rect(400, height - 180, 70, 180)
rect(550, height - 120, 50, 120)
rect(680, height - 160, 90, 160)
def draw_text():
pushStyle()
textAlign(CENTER, CENTER)
textSize(48)
fill(255, 215, 0) # 金色
text("新年快乐", width/2, 80)
textSize(24)
fill(255, 182, 193) # 粉色
text("2026", width/2, 120)
textSize(16)
fill(200, 200, 255, 200)
text("点击鼠标左键放烟花", width/2, height - 30)
popStyle()
def mousePressed():
if mouseButton == LEFT:
fireworks.append(Firework(mouseX, mouseY))
Rhossolas
import random
import math
particles = []
fireworks = []
static_windows = []
click_count = 0
mega_firework = None
class Particle:
def \__init_\_(self, x, y, color, velocity_multiplier=1, size_range=(1, 4)):
self.x = x
self.y = y
angle = random.uniform(0, TWO_PI)
speed = random.uniform(1, 6) \* velocity_multiplier
self.vx = cos(angle) \* speed
self.vy = sin(angle) \* speed
self.color = color
self.life = 255
self.max_life = 255
self.size = random.uniform(size_range\[0\], size_range\[1\])
self.trail = \[\]
def update(self):
# 保存轨迹
self.trail.append((self.x, self.y))
if len(self.trail) > 5:
self.trail.pop(0)
self.x += self.vx
self.y += self.vy
self.vy += 0.15 # 重力
self.vx \*= 0.97 # 空气阻力
self.life -= 2 # 淡出速度
def draw(self):
if self.life > 0:
pushStyle()
# 绘制轨迹
for i, (tx, ty) in enumerate(self.trail):
trail_alpha = (i / len(self.trail)) \* (self.life / 255) \* 100
trail_size = self.size \* (i / len(self.trail)) \* 0.5
fill(red(self.color), green(self.color), blue(self.color), trail_alpha)
noStroke()
ellipse(tx, ty, trail_size, trail_size)
# 绘制主粒子
fill(red(self.color), green(self.color), blue(self.color), self.life)
noStroke()
ellipse(self.x, self.y, self.size, self.size)
# 添加光晕效果
glow_size = self.size \* 2
glow_alpha = self.life \* 0.3
fill(red(self.color), green(self.color), blue(self.color), glow_alpha)
ellipse(self.x, self.y, glow_size, glow_size)
popStyle()
class Firework:
def \__init_\_(self, x, y, is_mega=False):
self.x = x
self.y = y
self.start_y = height
self.y_pos = self.start_y
self.exploded = False
self.is_mega = is_mega
if is_mega:
self.color = color(255, 255, 255) # 白色,稍后会用多种颜色
self.particle_count = 200
self.explosion_size = 3
else:
self.color = color(random.randint(150, 255), random.randint(150, 255), random.randint(150, 255))
self.particle_count = 60
self.explosion_size = 1
def update(self):
if not self.exploded:
speed = 12 if self.is_mega else 8
self.y_pos -= speed
if self.y_pos <= self.y:
self.explode()
self.exploded = True
def explode(self):
if self.is_mega:
# 超大烟花:多层彩色爆炸
colors = \[
color(255, 0, 0), # 红
color(255, 165, 0), # 橙
color(255, 255, 0), # 黄
color(0, 255, 0), # 绿
color(0, 0, 255), # 蓝
color(128, 0, 128), # 紫
color(255, 192, 203) # 粉
\]
for i, col in enumerate(colors):
for j in range(30):
angle = random.uniform(0, TWO_PI)
radius = random.uniform(50, 150)
px = self.x + cos(angle) \* radius
py = self.y + sin(angle) \* radius
particles.append(Particle(px, py, col, 2, (3, 8)))
else:
# 普通烟花
for i in range(self.particle_count):
angle = random.uniform(0, TWO_PI)
speed = random.uniform(1, 7)
px = self.x + cos(angle) \* speed \* 2
py = self.y + sin(angle) \* speed \* 2
particles.append(Particle(px, py, self.color, 1, (2, 6)))
def draw(self):
if not self.exploded:
pushStyle()
# 火箭轨迹
stroke(self.color)
strokeWeight(3)
line(self.x, self.y_pos + 15, self.x, self.y_pos)
# 火箭头部
fill(self.color)
noStroke()
ellipse(self.x, self.y_pos, 6, 6)
# 火箭光晕
fill(red(self.color), green(self.color), blue(self.color), 100)
ellipse(self.x, self.y_pos, 12, 12)
popStyle()
def setup():
size(800, 600)
background(20, 25, 40)
create_static_windows()
def create_static_windows():
# 建筑物窗户位置
window_positions = \[
(120, height - 180), (140, height - 160), (160, height - 140),
(270, height - 130), (290, height - 110),
(420, height - 160), (440, height - 140), (460, height - 120),
(560, height - 100),
(700, height - 140), (720, height - 120), (740, height - 100)
\]
for x, y in window_positions:
# 随机一些窗户亮着
if random.random() > 0.3:
static_windows.append((x, y, color(255, 255, 150))) # 暖黄色灯光
else:
static_windows.append((x, y, color(50, 50, 30))) # 暗色
def draw():
# 绘制夜晚背景
draw_background()
# 绘制静态窗户
draw_static_windows()
# 更新和绘制烟花
for firework in fireworks\[:\]:
firework.update()
firework.draw()
if firework.exploded and firework.y_pos <= firework.y:
fireworks.remove(firework)
# 更新和绘制超大烟花
if mega_firework:
mega_firework.update()
mega_firework.draw()
if mega_firework.exploded and mega_firework.y_pos <= mega_firework.y:
global mega_firework
mega_firework = None
# 更新和绘制粒子
for particle in particles\[:\]:
particle.update()
particle.draw()
if particle.life <= 0:
particles.remove(particle)
# 绘制文字
draw_text()
def draw_background():
# 深蓝天色渐变
for i in range(height):
inter = map(i, 0, height, 0, 1)
c = lerpColor(color(20, 25, 40), color(10, 15, 30), inter)
stroke(c)
line(0, i, width, i)
# 绘制星星
fill(255, 255, 200, 150)
noStroke()
for i in range(80):
x = (i \* 137.5 + frameCount \* 0.1) % width
y = (i \* 89) % (height // 2)
size = sin(frameCount \* 0.05 + i) \* 1.5 + 2
ellipse(x, y, size, size)
# 绘制地面剪影
fill(0, 20, 10)
beginShape()
vertex(0, height)
vertex(0, height - 100)
for x in range(0, width, 50):
y = height - 100 + sin(x \* 0.01) \* 20
vertex(x, y)
vertex(width, height - 100)
vertex(width, height)
endShape(CLOSE)
# 绘制建筑物剪影
fill(0, 15, 8)
rect(100, height - 200, 80, 200)
rect(250, height - 150, 60, 150)
rect(400, height - 180, 70, 180)
rect(550, height - 120, 50, 120)
rect(680, height - 160, 90, 160)
def draw_static_windows():
for x, y, window_color in static_windows:
pushStyle()
fill(window_color)
noStroke()
rect(x, y, 12, 12)
# 窗户光晕效果
if red(window_color) > 200: # 如果是亮着的窗户
fill(red(window_color), green(window_color), blue(window_color), 50)
rect(x-2, y-2, 16, 16)
popStyle()
def draw_text():
pushStyle()
textAlign(CENTER, CENTER)
textSize(48)
fill(255, 215, 0) # 金色
text("Happy New Year", width/2, 80)
textSize(24)
fill(255, 182, 193) # 粉色
text("2026", width/2, 120)
textSize(16)
fill(200, 200, 255, 200)
text("Click to launch fireworks! (Click 26 times for special surprise)", width/2, height - 30)
# 显示点击计数
textSize(14)
fill(255, 255, 255, 150)
text("Clicks: " + str(click_count) + "/26", width/2, height - 10)
popStyle()
def mousePressed():
global click_count, mega_firework
if mouseButton == LEFT:
click_count += 1
if click_count == 26:
# 彩蛋:超大烟花
mega_firework = Firework(width/2, height/3, is_mega=True)
click_count = 0 # 重置计数
else:
# 普通烟花
fireworks.append(Firework(mouseX, mouseY))
Rhossolas
12月25日
https://pan.baidu.com/s/12HQYFTl277KQC_81NIFkqQ?pwd=CDQZ
提取码:CDQZ
Rhossolas
# 导入必要的库
add_library('peasycam')
# 全局变量
fireworks = []
particles = []
stars = []
def setup():
# 设置画布大小
size(800, 600)
# 创建随机分布的星星
for i in range(100):
stars.append({
'x': random(width),
'y': random(height \* 0.7), # 只在天空区域
'size': random(1, 3),
'twinkle': random(0.5, 1)
})
def draw():
# 绘制渐变夜空背景
draw_night_sky()
# 绘制闪烁的星星
draw_stars()
# 更新和绘制烟花
for fw in fireworks\[:\]:
fw.update()
fw.display()
if fw.is_dead():
fireworks.remove(fw)
# 更新和绘制粒子
for p in particles\[:\]:
p.update()
p.display()
if p.is_dead():
particles.remove(p)
# 绘制新年祝福文字
draw_new_year_text()
def mousePressed():
# 在鼠标点击处创建烟花
fireworks.append(Firework(mouseX, mouseY))
def draw_night_sky():
# 从深蓝到深紫的渐变夜空
for i in range(height):
c = lerpColor(color(10, 10, 40), color(40, 10, 60), i / float(height))
stroke(c)
line(0, i, width, i)
def draw_stars():
# 绘制闪烁的星星
for star in stars:
# 添加闪烁动画
brightness = star\['twinkle'\] + sin(frameCount \* 0.1 + star\['x'\] \* 0.01) \* 0.3
brightness = constrain(brightness, 0.3, 1)
fill(255, 255, 200, brightness \* 255)
noStroke()
ellipse(star\['x'\], star\['y'\], star\['size'\], star\['size'\])
def draw_new_year_text():
# 主标题
textAlign(CENTER, CENTER)
textSize(80)
# 金色渐变效果
for i in range(5):
fill(255, 255, 0, 150 - i \* 30)
text("新年快乐", width / 2, height \* 0.25 + i)
# 副标题
textSize(30)
fill(255, 255, 242)
text("2025年 · 点击放烟花", width/2, height\*0.4)
class Firework:
def \__init_\_(self, x, y):
self.x = x
self.y = y
self.color = color(random(255), random(255), random(255))
self.velocity = PVector(0, -random(10, 15)) # 上升速度
self.life = 255
self.exploded = False
self.trail = \[\] # 轨迹
def update(self):
if not self.exploded:
# 更新位置
self.velocity.y += 0.2 # 重力
self.y += self.velocity.y
# 记录轨迹
self.trail.append({'x': self.x, 'y': self.y, 'life': 255})
# 轨迹逐渐消失
for t in self.trail:
t\['life'\] -= 5
# 清理消失的轨迹点
self.trail = \[t for t in self.trail if t\['life'\] > 0\]
# 到达顶点或速度变为正值时爆炸
if self.velocity.y >= 0 or self.y < height \* 0.2:
self.explode()
self.exploded = True
def explode(self):
# 创建爆炸粒子
particle_count = int(random(80, 150))
for i in range(particle_count):
angle = TWO_PI \* i / particle_count + random(-0.5, 0.5)
speed = random(2, 8)
if random() < 0.3: # 30%几率创建闪光粒子
particles.append(Particle(self.x, self.y, angle, speed,
p_type='sparkle', color=self.color))
else:
particles.append(Particle(self.x, self.y, angle, speed,
p_type='normal', color=self.color))
def display(self):
if not self.exploded:
# 绘制发射轨迹
for t in self.trail:
fill(255, 255, 200, t\['life'\])
noStroke()
ellipse(t\['x'\], t\['y'\], 3, 3)
# 绘制烟花本体
fill(self.color)
ellipse(self.x, self.y, 5, 5)
def is_dead(self):
return self.exploded and len(self.trail) == 0
class Particle:
def \__init_\_(self, x, y, angle, speed, p_type='normal', color=color(255, 255, 0)):
self.x = x
self.y = y
self.position = PVector(x, y)
self.velocity = PVector(cos(angle) \* speed, sin(angle) \* speed)
self.color = color
self.life = 255
self.max_life = 255
self.p_type = p_type
self.size = random(2, 6) if p_type == 'normal' else random(4, 8)
self.gravity = 0.05 if p_type == 'normal' else 0.02
def update(self):
# 更新位置
self.velocity.y += self.gravity
self.position.add(self.velocity)
self.x = self.position.x
self.y = self.position.y
# 添加空气阻力
self.velocity.mult(0.99)
# 生命周期
self.life -= 2
def display(self):
# 根据类型绘制不同粒子
if self.p_type == 'sparkle':
# 闪光粒子 - 更大更亮
fill(255, 255, 255, self.life)
ellipse(self.x, self.y, self.size, self.size)
# 添加光晕效果
fill(255, 255, 200, self.life \* 0.3)
ellipse(self.x, self.y, self.size \* 2, self.size \* 2)
else:
# 普通粒子
# 使用HSL颜色创造彩虹效果
h = (hue(self.color) + self.life \* 0.5) % 255
c = color(h, 200, 200)
fill(c, self.life)
ellipse(self.x, self.y, self.size, self.size)
def is_dead(self):
return self.life <= 0
Rhossolas
5月17日
"The bigger the galaxy, the sweeter the homecoming."
―Corellian proverb
Rhossolas
《雅歌》第八章第七节:「爱情,众水不能熄灭,大水也不能淹没。」
Rhossolas
「爱是比死刑更严厉的惩罚,也是比赦免更温柔的救赎。」
Rhossolas
爱情是完美的犯罪——我们互为主犯,互为共犯,互为不在场证明。
Rhossolas
5月10日
「El que encuentra la verdad, pierde la cabeza」
(找到真相的人会失去理智)
Rhossolas
「Aqui jaz o pecado original」
(此处安息着原罪)