import math
size_x = 800
size_y = 600
frames = 120 # 动画帧数,约 3 - 5 秒
background_color = color(20, 20, 20) # 深色背景
grid_color = color(180, 180, 180, 50) # 网格线颜色(银色,透明度 50%)
num_lines = 100
line_speed = 0.05
energy_ball_color = color(255, 204, 0) # 能量球颜色(金黄色)
energy_ball_size = 100 # 能量球初始大小
book_color = color(255, 204, 0) # 书籍颜色
book_size = 100 # 书籍初始大小
page_speed = 0.1
num_rays = 100
ray_speed = 0.05
research_images = [
"history.png", # 历史研究场景
"economy.png", # 经济数据分析图表
"society.png" # 社会调研现场
]
background_radius = 0
current_page = 0
logo_appear = False
def setup():
size(size_x, size_y)
background(background_color)
noStroke()
frameRate(60)
def draw():
global background_radius, current_page, logo_appear
fill(20, 20, 20, 10) # 深色半透明叠加背景,实现动态模糊效果
rect(0, 0, size_x, size_y)
fill(grid_color)
for i in range(num_lines):
angle = map(mouseX, 0, size_x, 0, TWO_PI * 0.1) + i * TWO_PI / num_lines
radius = map(sin(frameCount * line_speed + i * 0.1), -1, 1, size_x * 0.5, size_x * 0.8)
x = size_x / 2 + radius * cos(angle)
y = size_y / 2 + radius * sin(angle)
ellipse(x, y, 1, 1)
fill(255, 204, 0, 50) # 能量球的反射光
for i in range(num_rays):
angle = map(frameCount * ray_speed + i * 0.1, 0, width, 0, TWO_PI)
radius = map(sin(frameCount * ray_speed), -1, 1, 0, size_x * 0.9)
x = size_x / 2 + radius * cos(angle)
y = size_y / 2 + radius * sin(angle)
ellipse(x, y, 2, 2)
fill(energy_ball_color)
ellipse(size_x / 2, size_y / 2, energy_ball_size, energy_ball_size)
energy_ball_size -= 1 # 球体逐渐缩小
if energy_ball_size < 50 and not logo_appear:
book_pos_x = size_x / 2 + (size_x / 2 - energy_ball_size / 2) * cos(frameCount * 0.02)
book_pos_y = size_y / 2 + (size_y / 2 - energy_ball_size / 2) * sin(frameCount * 0.02)
fill(book_color)
rect(book_pos_x, book_pos_y, book_size, book_size * 0.7)
fill(255)
current_page += page_speed
if current_page >= len(research_images):
current_page = 0
image(loadImage(research_images[int(current_page)]), book_pos_x, book_pos_y, book_size, book_size * 0.7)
if int(current_page) == len(research_images) - 1:
logo_appear = True
image(loadImage("logo.jpg"), book_pos_x, book_pos_y, book_size, book_size * 0.7) # 显示湖南省社科院 logo
if logo_appear:
fill(180, 180, 180)
for i in range(36):
angle = i * TWO_PI / 18
x1 = size_x / 2 + (size_x / 2 - energy_ball_size) * cos(angle)
y1 = size_y / 2 + (size_x / 2 - energy_ball_size) * sin(angle)
x2 = size_x / 2 + (size_x / 2 - energy_ball_size) * cos(angle + TWO_PI / 36)
y2 = size_y / 2 + (size_x / 2 - energy_ball_size) * sin(angle + TWO_PI / 36)
line(x1, y1, x2, y2)
fill(255, 204, 0)
ellipse(size_x / 2, size_y / 2, book_size * 1.2, book_size * 1.2) # 突出 logo
if frameCount > frames:
noLoop()
run(frame_rate=60)