当前位置: 首页 > news >正文

网站使用网络图片做素材 侵权东莞谷歌推广

网站使用网络图片做素材 侵权,东莞谷歌推广,安阳,外贸网站做的作用是什么目录 新年祝福语 一、作品展示 二、作品所用资源 三、代码与资源说明 四、代码库 五、完整代码 六、总结 新年祝福语 岁月总是悄然流转,让人感叹时间的飞逝,转眼间又快到了中国传统的新年(龙年)。 回首过去&#xf…

目录

新年祝福语

一、作品展示 

二、作品所用资源 

三、代码与资源说明 

四、代码库

五、完整代码 

六、总结 


新年祝福语

岁月总是悄然流转,让人感叹时间的飞逝,转眼间又快到了中国传统的新年(龙年)。

回首过去,我们经历了许多挑战,也收获了成长。展望未来,我们充满期待。

在这特别的时刻,我想对所有粉丝送上真挚祝福。愿新年带给你们无尽的快乐与幸福,健康与平安。

感谢你们的支持,新的一年我将继续努力创造更多精彩。

祝大家新年快乐!


一、作品展示 

以下是我用 [python] 制作的一个新年小作品,希望大家喜欢(龙年背景图是免费下载的)!

二、作品所用资源 

由于 pygame 本身不支持中文显示,所以需要自行下载中文字体,而其自带的数字字体不好看,所以也一并下载了(代码中的字体与背景图大家自行更换)

1. 小清新中文字体

2. 立体数字字体

3. 免费的背景图

三、代码与资源说明 

百度云盘完整资源下载:新年快乐

这里展示代码与资源存放位置,是为了方便大家看代码时容易理解其中的内容。 

 

四、代码库

本文主要用到了以下四个库。如果大家还没安装,可以 win + r 输入 cmd 安装。

pip install pygame
pip install random
pip install math
pip install os

五、完整代码 

以下是完整的代码。其中,爆竹音效我没有添加,但有预留实现接口,大家如果感兴趣可以网上找相应的音频文件,并且将已注释的接口打开来播放即可。

import pygame
import random
import math
import os# 初始化pygame
pygame.init()# 设置窗口大小和标题
screen_width, screen_height = 800, 600
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Fireworks")# 加载动态背景图
bg_images = []
for i in range(1, 3):  # 替换为你的动态背景图文件名的范围image_path = f"D:\\share\\python\\HappNewYear\\pic\\dragon_animation_{i}.png"  # 替换为你的动态背景图路径image = pygame.image.load(image_path).convert()bg_images.append(image)# 加载爆炸音效
# explosion_sound = pygame.mixer.Sound('explosion.wav')# 定义烟花线条类
class FireworkParticle(pygame.sprite.Sprite):def __init__(self, x, y, color):super().__init__()self.color = colorself.length = random.randint(5, 15)  # 线条长度self.angle = random.uniform(0, 2 * math.pi)self.speed = random.uniform(1, 5)self.dx = self.speed * math.cos(self.angle)self.dy = self.speed * math.sin(self.angle)self.gravity = 0.1self.x = xself.y = ydef update(self):self.x += self.dxself.y += self.dyself.dy += self.gravitydef draw(self, screen):end_x = self.x + self.length * math.cos(self.angle)end_y = self.y + self.length * math.sin(self.angle)pygame.draw.line(screen, self.color, (self.x, self.y), (end_x, end_y), 2)  # 绘制线条# 颜色列表
colors = [(253, 215, 88), (254, 254, 252), (255, 255, 217), (252, 253, 249), (248, 247, 106), (255, 255, 162)]# 字体显示
font_path = os.path.join(os.path.dirname(__file__), 'font_ttf\\xiaoqingxin.ttf')
zn_font = pygame.font.Font(font_path, 100)
def font_show(font, string, color):text = font.render(string, True, color)text_rect = text.get_rect(center=(screen_width // 2, screen_height // 2))screen.blit(text, text_rect)# 烟花爆炸函数
def explode(x, y, timeout):# explosion_sound.play()  # 播放爆炸音效particles = pygame.sprite.Group()for _ in range(1000): #燃放的烟火密度,值越大越好看color = random.choice(colors)particle = FireworkParticle(x, y, color)  # 烟花燃放位置particles.add(particle)# 爆炸动画循环current_bg_image = 0  # 当前显示的背景图索引last_explode_time = pygame.time.get_ticks()while True:current_time = pygame.time.get_ticks()if current_time - last_explode_time >= timeout:break  # 退出循环particles.update()# 切换背景图if current_time % 50 == 0:  # 每50毫秒切换一次背景图current_bg_image = (current_bg_image + 1) % len(bg_images)screen.blit(bg_images[current_bg_image], (0, 0)) # 绘制背景图font_show(zn_font, "龙年行大运", (255, 0, 0))for particle in particles:particle.draw(screen)  # 绘制烟花粒子pygame.display.flip()  # 更新屏幕显示pygame.time.Clock().tick(60)  # 控制帧率# explosion_sound.stop()  # 停止音效# 显示新年倒数
def countdown():screen.fill((255, 0, 0))  # 清空屏幕font_show(zn_font, "跨年倒数", (255, 215, 0))pygame.display.flip()  # 更新屏幕显示pygame.time.delay(1000)  # 延迟1秒# font = pygame.font.Font(None, 100)font_path = os.path.join(os.path.dirname(__file__), 'font_ttf\\Antology.ttf')font = pygame.font.Font(font_path, 100)countdown_time = 3  # 倒数时间last_countdown_time = pygame.time.get_ticks()while countdown_time > 0:current_time = pygame.time.get_ticks()if current_time - last_countdown_time >= 1000:last_countdown_time = current_timecountdown_time -= 1screen.fill((255, 0, 0))  # 清空屏幕font_show(font, str(countdown_time), (255, 215, 0))pygame.display.flip()  # 更新屏幕显示pygame.time.Clock().tick(60)  # 控制帧率screen.fill((255, 0, 0))  # 清空屏幕font_show(zn_font, "积步千里祝大家", (255, 215, 0))pygame.display.flip()  # 更新屏幕显示pygame.time.delay(1000)  # 延迟1秒screen.fill((255, 0, 0))  # 清空屏幕font_show(zn_font, "新年快乐", (255, 215, 0))pygame.display.flip()  # 更新屏幕显示pygame.time.delay(1000)  # 延迟1秒# 主程序循环
running = True
auto_explode_interval = 2000  # 自动循环燃放的时间间隔(毫秒)
last_explode_time = pygame.time.get_ticks()countdown()  # 显示新年倒数while running:for event in pygame.event.get():if event.type == pygame.QUIT:running = Falsecurrent_time = pygame.time.get_ticks()if current_time - last_explode_time >= auto_explode_interval:last_explode_time = current_timex_offset = screen_width // 2 - 240y_offset = screen_heightfor i in range(4):x_offset += (i * 80)y_offset = screen_height // (2 + i)explode(x_offset, y_offset, 2000)pygame.display.flip()  # 更新屏幕显示pygame.time.Clock().tick(60)  # 控制帧率# 退出pygame
pygame.quit()

六、总结 

至此,本文内容已全部讲解完毕。祝愿大家在新的一年里龙腾虎跃,龙行天下,龙凤呈祥! 

http://www.15wanjia.com/news/34694.html

相关文章:

  • 网站营销信息广州seo黑帽培训
  • n加1网站建设开发新客户的十大渠道
  • 解析网站接口怎么做百度在线搜索
  • 在线黑科技网站百度推广搜索排名
  • 苏州 网站制作公司网图识别在线百度
  • 石家庄网站建设企业磁力狗在线引擎
  • 官方网站找oem做洗发水厂家宁波seo外包推广平台
  • 网站建设实训的报告品牌策划与推广方案
  • jsp网站建设美食google adsense
  • 网站建设制作百度知道官网首页登录入口
  • wordpress 手机站目录微博推广价格表
  • 内蒙古网站建设百度怎么推广app
  • 如何在服务器上做网站上海网站建设关键词排名
  • 去哪个网站可以接单做ps等等推广app是什么工作
  • 织梦模板下载商城网站模板(高端大气上档次:带数据)seo是什么的缩写
  • 郑州免费网站制作百度竞价开户哪家好
  • 涪城移动网站建设沈阳seo按天计费
  • 广州网站制作企业热搜榜排名前十
  • 网站上的截图怎么做企业网站推广效果指标分析
  • 网站热力图怎么做网站优化企业排名
  • 怎样做风水网站代写
  • 阳泉网站设计爱站网关键词搜索
  • 网页设计与网站建设考试免费企业建站
  • 张家港建设工程质量监督站网站网站页面布局和样式设计
  • 税务网站建设 目标推广网页怎么做的
  • 讨债公司网站建设网站市场推广
  • 做中东市场哪个网站合适十八大禁用黄app入口
  • 专业企业建站价格软文推广的优点
  • 网站建设包括哪方面电商网站建设哪家好
  • 武汉做网站找哪家免费推广软件平台