520表白程序(C++)
c语言表白代码
![c语言表白代码](https://img.taocdn.com/s3/m/ed0d112c54270722192e453610661ed9ad515512.png)
C语言表白代码简介在这个数字化的时代,人们常常通过各种方式表达自己的爱意,而编程作为一种创造力的表达方式,也能够用来传达情感。
C语言作为一门广泛应用于系统编程和底层开发的高效语言,也可以被用来写出一段特殊的代码,来表达对某个人的爱意。
这个任务就是让我们编写一段”C语言表白代码”,让计算机为我们传递爱情的信息。
代码实现下面是一段用C语言写的表白代码:#include<stdio.h>int main() {printf("亲爱的,我想对你说:\n");printf("I love you!\n");printf("我愿意和你\n");printf("一起写下人生的代码\n");printf("无论是快乐的时光\n");printf("还是困难的挑战\n");printf("只要我们携手同行\n");printf("就能够克服一切\n");printf("你是我生命中的光芒\n");printf("有了你\n");printf("世界变得更加美好\n");printf("爱你永远!\n");return 0;}代码解析1.首先,我们使用#include<stdio.h>来导入标准输入输出库,这样我们就能够使用printf函数来输出信息到控制台。
2.在main函数中,我们使用printf函数分多次输出表白的内容。
我们首先使用\n来进行换行,使得输出更加美观。
3.在第2行代码中,我们输出了一个固定的文字:“亲爱的,我想对你说:”。
这是对被表白者的称呼,然后表示接下来要向TA表达爱意。
4.在第3行代码中,我们使用printf函数输出了一句表白的话:“I loveyou!”。
C语言实现520表白代码祝你表白成功!
![C语言实现520表白代码祝你表白成功!](https://img.taocdn.com/s3/m/282d1175793e0912a21614791711cc7931b77844.png)
C语⾔实现520表⽩代码祝你表⽩成功!本⽂实例为⼤家分享了C语⾔实现520表⽩的具体代码,供⼤家参考,具体内容如下在这个狂虐单⾝狗的节⽇,实在⽆聊写了⼏⾏也不知道向谁告⽩的代码,献丑献丑:#include<stdio.h>#include<math.h>int main(){float y, x, z;printf("那⼀天\n");printf("第⼀次遇见你\n");printf("忘不了\n");printf("你的容颜\n");printf("若轻云之蔽⽉,如流风之回雪\n");printf("\n\n\n");printf("其实\n");printf("有⼀句话\n");printf("我⼀直想对你说:\n");for (double y = 2.5; y >= -1.6; y = y - 0.2){for (double x = -3; x <= 4.8; x = x + 0.1){(pow((x*x + y*y - 1), 3) <= 3.6*x*x*y*y*y|| (x>-2.4 && x<-2.1 && y<1.5 && y>-1)|| (((x<2.5 && x>2.2) || (x>3.4 && x<3.7)) && y>-1 && y<1.5)|| (y>-1 && y<-0.6 && x<3.7 && x>2.2)) ? printf("*") : printf(" ");}printf("\n");}getchar();}运⾏效果图:代码⼆#include <stdio.h>#include <math.h>#include <stdlib.h>#define I 20#define R 340#include <string.h>int main(){char answer[10];printf("遇到你\n我才发现\n曾经所有的条件\n似乎都成了我等你的借⼝\n\n");printf("请允许我,从今往后映⼊你\n明媚的眼\n");printf("输⼊yes或no,点击Enter");printf("\n ");scanf("%s", answer);char b[4]="yes";if(strcmp(answer,b)==0){float y, x, z, f;for (y = 1.5f; y > -1.5f; y -= 0.1f){for (x = -1.5f; x < 1.5f; x += 0.05f){z = x * x + y * y - 1;f = z * z*z - x * x*y*y*y;putchar(f <= 0.0f ? "*********"[(int)(f*-8.0f)] : ' ');}putchar('\n');}long time;for (;;){system("color a");for (time = 0; time<99999999; time++);system("color b");for (time = 0; time<99999999; time++);system("color c");for (time = 0; time<99999999; time++);system("color d");for (time = 0; time<99999999; time++);system("color e");for (time = 0; time<99999999; time++);system("color f");for (time = 0; time<99999999; time++);system("color 0");for (time = 0; time<99999999; time++);system("color 1");for (time = 0; time<99999999; time++);system("color 2");for (time = 0; time<99999999; time++);system("color 3");for (time = 0; time<99999999; time++);system("color 4");for (time = 0; time<99999999; time++);system("color 5");for (time = 0; time<99999999; time++);system("color 6");for (time = 0; time<99999999; time++);system("color 7");for (time = 0; time<99999999; time++);system("color 8");for (time = 0; time<99999999; time++);system("color 9");}getchar();}else{printf("\n好吧,那就相忘于江湖吧!\n");}return 0;}以上就是本⽂的全部内容,希望对⼤家的学习有所帮助,也希望⼤家多多⽀持。
520必备!这些Python表白代码祝你脱单成功
![520必备!这些Python表白代码祝你脱单成功](https://img.taocdn.com/s3/m/058e987d1fb91a37f111f18583d049649b660e8f.png)
520必备!这些Python表⽩代码祝你脱单成功⽬录⼀、浪漫玫瑰花⼆、浪漫玫瑰加爱⼼三、⼼⼼相印四、粉嫩爱⼼五、丘⽐特⼀键穿⼼六、发射爱⼼⼩⼈七、浪漫动态樱花树⼋、专属⼼形词云九、⼥朋友画像字符画⼀、浪漫玫瑰花实现代码:from turtle import *import timesetup(1000,800,0,0)speed(0)penup()seth(90)fd(340)seth(0)pendown()speed(5)begin_fill()fillcolor('red')circle(50,30)for i in range(10):fd(1)left(10)circle(40,40)for i in range(6):fd(1)left(3)for i in range(20): fd(0.5)left(5)circle(80,45)for i in range(10): fd(2)left(1)circle(80,25)for i in range(20): fd(1)left(4)circle(50,50) time.sleep(0.1) circle(120,55) speed(0)seth(-90)fd(70)right(150)fd(20)left(140)circle(140,90) left(30)circle(160,100) left(130)fd(25)penup()right(150) circle(40,80) pendown()left(115)fd(60)penup()left(180)fd(60) pendown()end_fill()right(120) circle(-50,50) circle(-20,90) speed(1)fd(75)speed(0)circle(90,110) penup()left(162)fd(185)left(170) pendown() circle(200,10) circle(100,40) circle(-52,115) left(20)circle(100,20) circle(300,20)fd(250)penup()speed(0)left(180)fd(250)circle(-300,7)right(80)circle(200,5)pendown()left(60)begin_fill()fillcolor('green')circle(-80,100)right(90)fd(10)left(20)circle(-63,127)end_fill()penup()left(50)fd(20)left(180)pendown()circle(200,25)penup()right(150)fd(180)right(40)pendown()begin_fill()fillcolor('green')circle(-100,80)right(150)fd(10)left(60)circle(-80,98)end_fill()penup()left(60)fd(13)left(180)pendown()speed(1)circle(-200,23)exitonclick()什么?只有玫瑰花太单调?那再给你来⼏个爱⼼够不够?⼆、浪漫玫瑰加爱⼼实现代码:import turtleimport timeimport random# 爱⼼函数def yellowheart(x, y, liftx):turtle.pensize(3)turtle.speed(10)turtle.color("red", "red")turtle.up()turtle.goto(x, y)turtle.down()turtle.begin_fill()turtle.left(liftx)turtle.fd(80)turtle.circle(-40, 180)turtle.left(90)turtle.circle(-40, 180)turtle.left(0)turtle.fd(80)turtle.end_fill()def rose():turtle.speed(0) # 画笔移动的速度#turtle.tracer(False)# 设置初始位置turtle.penup() # 提起画笔turtle.left(90) # 逆时针转动画笔90度turtle.fd(200)turtle.pendown() # 放下画笔,移动画笔即开始绘制 turtle.right(90)# 设置画笔的⼤⼩turtle.pensize(2)# 花蕊turtle.fillcolor("red") # 填充颜⾊turtle.begin_fill() # 开始填充turtle.circle(10, 180)turtle.circle(25, 110)turtle.left(50)turtle.circle(60, 45)turtle.circle(20, 170)turtle.right(24)turtle.left(10)turtle.circle(30, 110)turtle.fd(20)turtle.left(40)turtle.circle(90, 70)turtle.circle(30, 150)turtle.right(30)turtle.fd(15)turtle.circle(80, 90)turtle.left(15)turtle.fd(45)turtle.right(165)turtle.fd(20)turtle.left(155)turtle.circle(150, 80)turtle.left(50)turtle.circle(150, 90)turtle.end_fill() # 结束填充# 右侧花瓣turtle.left(150)turtle.circle(-90, 70)turtle.left(20)turtle.circle(75, 105)turtle.setheading(60)turtle.circle(80, 98)turtle.circle(-90, 40)# 左侧花瓣turtle.left(180)turtle.circle(90, 40)turtle.circle(-80, 98)turtle.setheading(-83)# 左侧叶⼦turtle.fd(30)turtle.left(90)turtle.fd(25)turtle.left(45)turtle.fillcolor("green")turtle.begin_fill()turtle.circle(-80, 90)turtle.right(90)turtle.circle(-80, 90)turtle.end_fill()turtle.right(135)turtle.fd(60)turtle.left(180)turtle.fd(85)turtle.left(90)turtle.fd(80)# 右侧叶⼦turtle.right(90)turtle.right(45)turtle.fillcolor("green")turtle.begin_fill()turtle.circle(80, 90)turtle.left(90)turtle.circle(80, 90)turtle.end_fill()turtle.left(135)turtle.fd(60)turtle.left(180)turtle.fd(60)turtle.right(90)turtle.circle(200, 50) # 画⼀个圆 200 是半径,50 是弧度 time.sleep(1)# turtle.tracer(False)#turtle.pensize(3)#turtle.speed(0)turtle.color("red", "red")turtle.goto(-230, 50)turtle.down()turtle.begin_fill()turtle.left(180)turtle.fd(80)turtle.circle(-40, 180) turtle.left(90)turtle.circle(-40, 180) turtle.left(0)turtle.fd(80)turtle.end_fill()time.sleep(1)# turtle.tracer(False) #turtle.pensize(3)#turtle.speed(0)turtle.color("red", "red") turtle.up()turtle.goto(-230, -80) turtle.down()turtle.begin_fill()turtle.left(-30)turtle.fd(80)turtle.circle(-40, 180) turtle.left(90)turtle.circle(-40, 180) turtle.left(0)turtle.fd(80)turtle.end_fill()time.sleep(1)# turtle.tracer(False) # turtle.pensize(3)# turtle.speed(0)turtle.color("red", "red") turtle.up()turtle.goto(-130, -180) turtle.down()turtle.begin_fill()turtle.left(-80)turtle.fd(80)turtle.circle(-40, 180) turtle.left(90)turtle.circle(-40, 180) turtle.left(0)turtle.fd(80)turtle.end_fill()time.sleep(1)# turtle.tracer(False) # turtle.pensize(3)# turtle.speed(0)turtle.color("red", "red") turtle.up()turtle.goto(200, -200) turtle.down()turtle.begin_fill()turtle.left(-90)turtle.fd(80)turtle.circle(-40, 180) turtle.left(90)turtle.circle(-40, 180) turtle.left(0)turtle.fd(80)turtle.end_fill()time.sleep(1)# turtle.tracer(False) # turtle.pensize(3)# turtle.speed(0)turtle.color("red", "red") turtle.up()turtle.goto(200, 50)turtle.down()turtle.begin_fill()turtle.fd(80)turtle.circle(-40, 180)turtle.left(90)turtle.circle(-40, 180)turtle.left(0)turtle.fd(80)turtle.end_fill()def figure1():turtle.reset()turtle.tracer(False)rose()yellowheart(-230, 50, 180) # 左⼀ #time.sleep(2)def figure2():# turtle.reset()turtle.tracer(False)rose()yellowheart(-230, -80, -30) # 左⼆ # time.sleep(2)def figure3():turtle.reset()turtle.tracer(False)rose()yellowheart(-130, -180, -30) # 左三 # time.sleep(2)def figure4():turtle.reset()turtle.tracer(False)rose()yellowheart(200, 50, 90) # 右⼀ # ime.sleep(2)def figure5():turtle.reset()turtle.tracer(False)rose()yellowheart(200, -200, -90) # 右⼆ # time.sleep(2)if __name__ == "__main__":rose()# figure1()## yellowheart(-230, -80, -30) # 左⼆ # 不让⾃动退出,放在程序的最后⼀⾏ # 不然画画结束后会⾃动退出turtle.done()coding:utf-8三、⼼⼼相印实现代码:from turtle import *from time import sleepdef go_to(x, y):up()goto(x, y)down()def small_Circle(size): # 函数⽤于绘制⼼的⼩圆speed(10)for i in range(210):forward(size)right(0.786)def big_Circle(size): # 函数⽤于绘制⼼的⼤圆speed(10)for i in range(150):forward(size)right(0.3)def line(size):speed(10)forward(51 * size)def heart(x, y, size):go_to(x, y)left(150)begin_fill()line(size)big_Circle(size)small_Circle(size)left(120)small_Circle(size)big_Circle(size)line(size)end_fill()def main():pensize(2)color('red', 'pink')getscreen().tracer(1, 0)heart(100, 0, 0.7)go_to(80, 70)write("先⽣", font=("楷体", 18, "normal"))setheading(0)heart(-80, -100, 1)go_to(-110, 15)write("⼩姐", font=("宋体", 20, "normal"))go_to(40, -80)write("三⽣有幸遇见你!", move=True, align="left", font=("arial", 22, "italic")) done()四、粉嫩爱⼼实现代码:'''不正经爱⼼'''#coding=utf-8import turtleimport timedef draw_circle():for i in range(400):turtle.right(0.5)turtle.forward(1)def draw_love():# turtle.color('red','darkred')# turtle.pensize(1)turtle.pen(fillcolor="pink", pencolor="red", pensize=8)turtle.speed(2000)turtle.goto(0, 0)turtle.begin_fill()turtle.left(140)turtle.forward(224)draw_circle()turtle.left(120)draw_circle()turtle.forward(224)turtle.end_fill()turtle.write("I Love you")time.sleep(2)turtle.up()turtle.goto(150, 20)turtle.color('black')turtle.write('纵然万劫不复,纵然相思⼊⾻,我待你依旧如初!', font=("微软雅⿊", 18, "normal")) time.sleep(2)def draw_abc():turtle.fillcolor("pink")turtle.pencolor("red")turtle.pensize(10)turtle.speed(1)turtle.up()turtle.goto(0, -50)turtle.down()turtle.begin_fill()turtle.circle(45)turtle.end_fill()time.sleep(2)def word():turtle.up()turtle.goto(-100, 200)turtle.color("red")turtle.write('宝贝,5.20快乐!', font=("⾪书", 18, "bold")) time.sleep(10)draw_love()draw_abc()word()五、丘⽐特⼀键穿⼼程序代码:import turtle as tt.color('red','pink')t.begin_fill()t.width(5)t.left(135)t.fd(100)t.right(180)t.circle(50,-180)t.left(90)t.circle(50,-180)t.right(180)t.fd(100)t.pu()t.goto(50,-30)t.pd()t.right(90)t.fd(100)t.right(180)t.circle(50,-180)t.left(90)t.circle(50,-180)t.right(180)t.fd(100)t.end_fill()t.hideturtle()t.pu()t.goto(250,-70)t.pd()t.color('black')t.width(5)t.left(70)t.fd(50)t.fd(-50)t.left(70)t.left(145)t.fd(20)t.left(145)t.fd(50)t.fd(-50)t.left(70)t.fd(50)t.fd(-50)t.left(145)t.fd(20)t.left(145)t.fd(50)t.fd(-50)t.left(70)t.fd(50)t.fd(-50)t.left(145)t.width(3)t.fd(220)t.right(90)t.pu()t.fd(10)t.pd()t.left(90)t.circle(10,180)t.circle(10,-90)t.right(90)t.fd(-10)t.pu()t.fd(90)t.left(90)t.fd(10)t.left(90)t.pd()t.circle(10,180)t.circle(10,-90)t.left(90)t.fd(100)t.begin_fill()t.left(30)t.fd(15)t.right(35)t.fd(50)t.right(150)t.fd(50)t.right(62)t.fd(25)t.end_fill()t.done()六、发射爱⼼⼩⼈实现代码:# 2.14from turtle import *from time import sleepdef go_to(x, y):up()goto(x, y)down()def head(x, y, r):go_to(x, y)speed(1)circle(r)leg(x, y)def leg(x, y):right(90)forward(180)right(30)forward(100)left(120)go_to(x, y - 180)forward(100)right(120)forward(100)left(120)hand(x, y)def hand(x, y):go_to(x, y - 60)forward(100)left(60)forward(100)go_to(x, y - 90)right(60)forward(100)right(60)forward(100)left(60)eye(x, y)def eye(x, y):go_to(x - 50, y + 130) right(90)forward(50)go_to(x + 40, y + 130) forward(50)left(90)def big_Circle(size):speed(20)for i in range(150):forward(size)right(0.3)def line(size):speed(1)forward(51 * size)def small_Circle(size): speed(10)for i in range(210):forward(size)right(0.786)def heart(x, y, size):go_to(x, y)left(150)begin_fill()line(size)big_Circle(size)small_Circle(size)left(120)small_Circle(size)big_Circle(size)line(size)end_fill()def main():pensize(2)color('red', 'pink')head(-120, 100, 100)heart(250, -80, 1)go_to(200, -300)write("To: 送给智慧与美貌并存的⼩仙⼥!", move=True, align="left", font=("楷体", 20, "normal")) done()main()七、浪漫动态樱花树实现代码:import turtle as Timport randomimport time# 画樱花的躯⼲(60,t)def Tree(branch, t):time.sleep(0.0005)if branch > 3:if 8 <= branch <= 12:if random.randint(0, 2) == 0:t.color('snow') # ⽩else:t.color('lightcoral') # 淡珊瑚⾊t.pensize(branch / 3)elif branch < 8:if random.randint(0, 1) == 0:t.color('snow')else:t.color('lightcoral') # 淡珊瑚⾊t.pensize(branch / 2)else:t.color('sienna') # 赭(zhě)⾊t.pensize(branch / 10) # 6t.forward(branch)a = 1.5 * random.random()t.right(20 * a)b = 1.5 * random.random()Tree(branch - 10 * b, t)t.left(40 * a)Tree(branch - 10 * b, t)t.right(20 * a)t.up()t.backward(branch)t.down()# 掉落的花瓣def Petal(m, t):for i in range(m):a = 200 - 400 * random.random()b = 10 - 20 * random.random() t.up()t.forward(b)t.left(90)t.forward(a)t.down()t.color('lightcoral') # 淡珊瑚⾊t.circle(1)t.up()t.backward(a)t.right(90)t.backward(b)# 绘图区域t = T.Turtle()# 画布⼤⼩w = T.Screen()t.hideturtle() # 隐藏画笔t.getscreen().tracer(5, 0)w.screensize(bg='wheat') # wheat⼩麦t.left(90)t.up()t.backward(150)t.down()t.color('sienna')# 画樱花的躯⼲Tree(60, t)# 掉落的花瓣Petal(200, t)w.exitonclick()⼋、专属⼼形词云实现代码:from wordcloud import WordCloudimport PIL.Image as imageimport numpy as npimport jieba# 分词def trans_CN(text):# 接收分词的字符串word_list = jieba.cut(text)# 分词后在单独个体之间加上空格result = " ".join(word_list)return result# 要读取的txt⽂本with open("love.txt", encoding="utf-8") as fp:text = fp.read()# print(text)# 将读取的中⽂⽂档进⾏分词text = trans_CN(text)mask = np.array(image.open("love.png")) #添加⼼形图⽚ wordcloud = WordCloud(# 添加遮罩层mask=mask,# ⽣成中⽂字的字体,必须要加,不然看不到中⽂font_path="C:\Windows\Fonts\STXINGKA.TTF").generate(text)image_produce = wordcloud.to_image()image_produce.show()九、⼥朋友画像字符画>实现代码:from PILimport Image, ImageDraw, ImageFontdef draw(pic, draw_text):img = cv2.imread(pic)blank = Image.new("RGB", [img.shape[1],img.shape[0]], "white")drawObj = ImageDraw.Draw(blank)n = 10m = 9font = ImageFont.truetype(font_path,size = m)for i in range(0, img.shape[0], n):for j in range(0, img.shape[1], n):drawObj.text([j, i],draw_text[int(j / n) % len(draw_text)],fill = (img[i][j][2], img[i][j][1],img[i][j][0]),font = font)blank.save('img_' + pic)draw('1.jpg', "我爱你")到此这篇关于520必备!这些Python表⽩代码祝你脱单成功的⽂章就介绍到这了,更多相关Python表⽩代码内容请搜索以前的⽂章或继续浏览下⾯的相关⽂章希望⼤家以后多多⽀持!。
JS实现520表白简单代码
![JS实现520表白简单代码](https://img.taocdn.com/s3/m/507777fe5ff7ba0d4a7302768e9951e79b8969a4.png)
JS实现520表⽩简单代码这两天不知道咋了,迷迷糊糊的,突然知道今天是520的我,急急忙忙赶出个程序(新⼿,代码有点乱),发出来⼤家⼀起研究下(参考百度的)。
<!DOCTYPE html><html><head><meta charset="utf-8"><title>520</title><style>html, body{padding:0px; margin:0px; background:#222; font-family: 'Karla', sans-serif; color:#FFF; height:100%; overflow:hidden;}canvas {width:100%; height:100%;}#text,#text_520{font-family:'楷体'; color:rgb(255,255,3); font-size:20px; position:fixed; left:10%; top:10%;}#text_520{font-size:100px; top:50%; left:50%;}img{position:fixed; top:0; left:0; width:100%;}#last{font-size:12px; bottom:10px; left:50%; position:fixed;}/*@keyframes drop {0% {transform: translateY(-100px);opacity: 0;}90% {opacity: 1;transform:translateY(10px);}100% {transform:translateY(0px;)}}*/</style></head><body><canvas id="c"></canvas><div id="text"></div><div id="text_520">5 2 0</div><img src="./timg.jpg" class="img" /><div id="last">版权所有:李晓珂</div><script type="text/javascript" src="./jquery-1.11.0.min.js"></script><script type="text/javascript">function isIE(){var u = erAgent;if((u.indexOf("compatible") > -1 && u.indexOf("MSIE") > -1) || (u.indexOf("Trident") > -1 && u.indexOf("rv:11.0") > -1)){alert("该浏览器暂不⽀持,请更换浏览器");window.open('','_self');window.close();}var audio = document.createElement("audio");audio.setAttribute("src","./520-love.mp3");audio.setAttribute("autoplay","autoplay");}isIE();</script><script type="text/javascript">var textArr = ['I love three things in this world,','the sun ,the moon and you.','The sun for the day,','the moon for the night,','and you forever!','','If you were a teardrop,','in my eye,','for fear of losing you,','I would never cry.','And if the golden sun,','should cease to shine its light,','just one smile from you,','would make my whole world bright.'];var text_520 = document.getElementById('text_520');var height = (window.innerHeight - text_520.offsetHeight) / 2;var width = (window.innerWidth - text_520.offsetWidth) / 2;text_520.style.top = height + 'px';text_520.style.left = width + 'px';$('#text_520').hide();$('.img').hide();var m = 0;var n = 0;var text = document.getElementById('text');function typing(){if(m <= textArr[n].length) {text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1) + textArr[n].substr(m++,1) + '_';setTimeout(typing,250);}else {if(n < textArr.length-1){text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1) + "<br />_";n++;m = 0;typing();}else {text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1);$('#text').fadeOut(5000);setTimeout(function(){$('#text_520').fadeIn(5000);},7000);setTimeout(function(){$('#text_520').fadeOut(5000); },7000);setTimeout(function(){$('.img').fadeIn(50000);},15000)}}}setTimeout(typing,5000);var ctx = document.querySelector('canvas').getContext('2d');ctx.canvas.width = window.innerWidth;ctx.canvas.height = window.innerHeight;var sparks = [];var fireworks = [];var walker;fireworks.pop();var i = 10;while(i--) fireworks.push(new Firework(Math.random()*window.innerWidth, window.innerHeight*Math.random())); // setInterval(render, 1000/50);render();function render() {setTimeout(render, 1000/50);ctx.fillStyle = 'rgba(0, 0, 0, 0.2)';ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);// 上升效果for(var firework of fireworks) {if(firework.dead) continue;firework.move();firework.draw();}// 绽放效果for(var spark of sparks) {if(spark.dead) continue;spark.move();spark.draw();}if(Math.random() < 0.1) fireworks.push(new Firework());//ctx.height = ctx.height;}function Spark(x, y, color) {this.x = x;this.y = y;this.dir = Math.random() * (Math.PI*2);this.dead = false;this.color = color;this.speed = Math.random() * 3 + 3;walker = new Walker({ radius: 20, speed: 0.25 });this.gravity = 0.25;this.dur = this.speed / 0.15;this.move = function() {this.dur--;if(this.dur < 0) this.dead = true;if(this.speed < 0) return;if(this.speed > 0) this.speed -= 0.15;walk = walker.step();this.x += Math.cos(this.dir + walk) * this.speed;this.y += Math.sin(this.dir + walk) * this.speed;this.y += this.gravity;this.gravity += 0.05;}this.draw = function() {drawCircle(this.x, this.y, 2, this.color);}}function Firework(x, y) {this.xmove = Math.random()*2 - 1;this.x = x || Math.random() * ctx.canvas.width;this.y = y || ctx.canvas.height;this.height = Math.random()*ctx.canvas.height/2;this.dead = false;this.color = randomColor();this.move = function() {this.x += this.xmove;if(this.y > this.height) this.y -= 4;else this.burst();}this.draw = function() {drawCircle(this.x, this.y, 3, this.color)}this.burst = function() {this.dead = truei = 100; while(i--) sparks.push(new Spark(this.x, this.y, this.color));sparks.pop();}}setTimeout(function (){window.open('','_self').close();},175000);/*// 清除两个数组function clear(){if(sparks!=null || fireworks!=null){sparks.pop();fireworks.pop();}var sparks = [];var fireworks = [];}setInterval(clear,100);*/function drawCircle(x, y, radius, color) {color = color || '#FFF';ctx.fillStyle = color;ctx.fillRect(x-radius/2, y-radius/2, radius, radius);}function randomColor(){return ['#6ae5ab','#88e3b2','#36b89b','#7bd7ec','#66cbe1'][Math.floor(Math.random() * 5)]; }function Walker(options){this.step = function(){this.direction = Math.sign(this.target) * this.speedthis.value += this.directionthis.targetthis.target -= this.direction: (this.value)(this.wander)this.target = this.newTarget(): this.target = -this.value: this.target = this.newTarget()return this.direction}this.newTarget = function() {return Math.round(Math.random()*(this.radius*2)-this.radius)}this.start = 0this.value = 0this.radius = options.radiusthis.target = this.newTarget()this.direction = Math.sign(this.target)this.wander = options.wanderthis.speed = options.speed || 1}</script></body></html>总结以上所述是⼩编给⼤家介绍的JS实现520 简单表⽩代码,希望对⼤家有所帮助,如果⼤家有任何疑问请给我留⾔,⼩编会及时回复⼤家的。
python波浪爱心表白代码
![python波浪爱心表白代码](https://img.taocdn.com/s3/m/f6c03c7e0a4c2e3f5727a5e9856a561253d32176.png)
python波浪爱心表白代码标题:用Python创作一个浪漫的波浪爱心表白程序引言:当爱情来临,我们总是希望以一种特别的方式表达自己的感受。
今天,我要介绍的是一个用Python编写的浪漫表白程序,通过代码的方式向心爱的人传达浓浓的爱意。
让我们一起来感受这个特别而又温馨的表白方式吧!第一部分:代码实现使用Python的turtle模块,我们可以轻松地绘制图形,通过迭代绘制心形和波浪线,实现一个浪漫的波浪爱心表白程序。
下面是代码示例:```pythonimport turtle# 设置画笔的初始位置和颜色turtle.penup()turtle.goto(0, -200)turtle.pendown()turtle.color('red')# 绘制心形for i in range(200):turtle.right(1)turtle.forward(2)turtle.left(140)for i in range(200):turtle.right(1)turtle.forward(2)# 绘制波浪线turtle.speed(10) turtle.penup() turtle.goto(-300, -200) turtle.pendown() turtle.color('blue') turtle.pensize(3)for x in range(360):turtle.forward(1)turtle.left(1)turtle.hideturtle() turtle.done()```第二部分:表白感言亲爱的,当我第一次遇见你的时候,我的世界变得如此美好。
你的笑容像阳光一样温暖,你的眼神像星星一样闪耀。
每一天,我都感受到你带给我的幸福和爱。
在这个特别的日子里,我想对你说一句话:我爱你!第三部分:表白效果当你运行这段代码,屏幕上将会出现一个美丽的波浪爱心。
心形代表着我对你的爱,波浪线则寓意着我们之间的爱情如波浪般起伏不定,但始终充满力量。
python520爱心代码
![python520爱心代码](https://img.taocdn.com/s3/m/89d92bf209a1284ac850ad02de80d4d8d15a0115.png)
python520爱心代码Python520爱心代码Python520爱心代码是一种特殊的代码,它可以在Python编程语言中实现一个爱心图案。
这个图案由两个半圆形组成,它们相交在一起,形成一个心形。
这个代码是由Python520社区开发的,它是一个开源的项目,任何人都可以使用它来创建自己的爱心图案。
Python520社区是一个致力于推广Python编程语言的组织,它由一群热爱Python的开发者组成。
这个社区致力于为Python爱好者提供一个学习和交流的平台,让更多的人了解和使用Python编程语言。
Python520爱心代码就是这个社区的一个成果,它不仅可以让人们学习Python编程语言,还可以让人们表达自己的爱心。
Python520爱心代码的实现方法很简单,只需要使用Python的turtle模块就可以了。
turtle模块是Python中一个非常有趣的模块,它可以让我们使用图形化的方式来学习编程。
使用turtle模块,我们可以画出各种各样的图形,包括爱心图案。
下面是Python520爱心代码的实现过程:1. 导入turtle模块import turtle2. 创建一个画布turtle.setup(800, 600) 3. 创建一个画笔pen = turtle.Turtle() 4. 设置画笔的颜色和粗细pen.color('red')pen.pensize(5)5. 画出左边的半圆形pen.circle(100, 180)6. 画出右边的半圆形pen.circle(100, 180)7. 画出两个半圆形的交点pen.left(45)pen.forward(141.42) pen.right(135)pen.forward(200)8. 完成爱心图案pen.hideturtle()这个代码可以在Python的开发环境中运行,也可以在Python的交互式命令行中运行。
运行这个代码后,就可以看到一个美丽的爱心图案了。
python高级表白代码
![python高级表白代码](https://img.taocdn.com/s3/m/e78f121aeffdc8d376eeaeaad1f34693daef1088.png)
python高级表白代码Python是一种简洁、易学易用的编程语言,也是许多程序员心中的最爱。
今天,我们将介绍一些用Python实现高级表白的代码。
首先,我们需要用Python编写一个程序,可以在屏幕上输出一些情话来表达爱意。
例如:```print('亲爱的,我想对你说:')print('你是我的唯一,我的爱人,我的幸福!')print('我喜欢你的微笑,喜欢你的眼睛,喜欢你的一切。
') print('请你接受我的爱意,嫁给我吧!')```这样,我们就可以在控制台中看到一段浪漫的情话了。
但是,用Python实现高级表白不仅仅是输出一些情话,我们还可以利用Python来制作一些个性化的表白软件。
例如,我们可以用Python实现一个程序,在屏幕上显示一张美丽的图片,同时附带一段浪漫的音乐和文字表白。
代码示例如下:```import pygamedef show_love():# 初始化pygamepygame.init()# 设置窗口大小和标题screen = pygame.display.set_mode((800, 600))pygame.display.set_caption('表白')# 加载图片并显示image = pygame.image.load('love.jpg')screen.blit(image, (0, 0))# 加载音乐并播放pygame.mixer.music.load('love.mp3')pygame.mixer.music.play()# 显示文字font = pygame.font.Font(None, 36)text = font.render('亲爱的,我爱你!', True, (255, 0, 0)) screen.blit(text, (300, 500))# 刷新屏幕pygame.display.flip()# 等待用户关闭窗口while True:for event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()returnshow_love()```这个程序会在屏幕上显示一张名为“love.jpg”的图片,并播放一首名为“love.mp3”的音乐。
c语言表白代码
![c语言表白代码](https://img.taocdn.com/s3/m/e1af6c26591b6bd97f192279168884868762b824.png)
c语言表白代码C语言表白代码,是程序员们为了向自己喜欢的人表达自己的情感而创建的一种代码,这种代码非常浪漫,而且缘起于程序员们平日里所熟悉的计算机语言,通过程序语句来表达自己的心意。
C语言表白代码虽然比较简单,但却营造了浪漫的氛围,给人们带来了不同寻常的感动。
下面,我来为大家介绍一下C语言表白的相关内容,及其要求。
首先,C语言表白代码需要用到一些基本的程序语句,例如if语句、循环语句等基本语句,这些语句是表白程序的基础。
其次,表白代码需要注意程序的正确性和规范性,要保证程序的可读性和可执行性。
接下来,我就为大家演示一下C语言表白的示例代码:#include <stdio.h>int main(){int i, j;for (i = 0; i < 520; i++){for (j = 0; j < i; j++){printf("♥");//打印心形}printf("\n");}printf("我要说的是:亲爱的你,我喜欢你!\n");//表白语句return 0;}在这段代码中,我们使用了for循环来打印出一个简单的心形图案,并在结尾添加了一句表白的话语“亲爱的你,我喜欢你!”,通过这种浪漫的方式表达自己的情感,营造了一种浪漫的氛围。
当然,这只是一个简单的例子,实际编写表白代码时,可以根据自己的喜好和情感来编写不同的程序,比如可以加上图片、音乐等元素,营造更加浪漫的氛围。
总之,C语言表白代码是一种别具一格的方式,通过程序的形式表达自己的情感,给人们带来了不一样的感动体验,它将程序员们独特的思想和娴熟的技巧完美结合,打造出了一种独特的浪漫方式,成为了程序员们向自己喜欢的人表达情感的一种特殊方式。
c语言写的表白代码
![c语言写的表白代码](https://img.taocdn.com/s3/m/ad0b63a60875f46527d3240c844769eae009a3b9.png)
c语言写的表白代码表白代码。
在程序员的世界里,表白也可以用代码来实现。
下面就让我们来看看一段用C语言写的表白代码吧。
```c。
#include <stdio.h>。
int main() {。
printf("I ");printf("love ");printf("you ");return 0;}。
```。
这段简单的代码就是用来表白的。
当我们运行这段代码时,屏幕上就会输出“I love you”。
虽然这段代码很简单,但是却蕴含着深情的表白之意。
在现实生活中,表白往往是一件让人紧张的事情。
但是在程序员的世界里,表白却可以变得轻松而有趣。
通过编写一段表白代码,不仅可以表达自己的情感,还可以展现自己的技术能力。
这样的表白方式不仅独特,还能给双方留下深刻的印象。
当然,表白代码并不是每个人都能写得出来的。
要想写出一段有趣、有爱的表白代码,首先需要对编程语言有一定的了解和掌握。
其次,还需要有一颗浪漫的心和一份创意。
只有将这两者结合起来,才能写出一段让人心动的表白代码。
除了C语言之外,还有很多其他编程语言也可以用来表白。
比如Python、Java、JavaScript等等。
每一种编程语言都有自己独特的特点,可以用来表达不同的情感。
比如Python的简洁、Java的稳重、JavaScript的灵活等等。
不同的编程语言可以带来不同的表白体验,可以根据自己和对方的喜好来选择合适的编程语言来表达自己的情感。
除了编程语言之外,表白代码还可以结合一些其他的元素来增加趣味性。
比如可以加上一些图形、动画或者音乐效果。
这样一来,不仅可以表达自己的情感,还可以给对方带来更多的惊喜和感动。
当然,表白代码只是一种表白方式,它并不适用于所有的情况。
在某些情况下,传统的表白方式可能更加合适。
但是无论是传统的表白方式还是表白代码,最重要的是表达出自己的真情。
只有真诚的情感才能打动对方的心。
c语言代码玫瑰花和爱心的代码
![c语言代码玫瑰花和爱心的代码](https://img.taocdn.com/s3/m/8e23ff346ad97f192279168884868762caaebb0b.png)
c语言代码玫瑰花和爱心的代码C语言是一门广泛应用的编程语言,在各种领域都具有广泛的应用。
无论是科技、制造还是娱乐,都离不开这门编程语言。
在编写C 语言代码时,除了实现实际功能外,还可以使用一些特殊的代码来构造自己的“玫瑰花和爱心”的图案。
在本文中,我们将探讨如何通过C 语言编写“玫瑰花和爱心”的代码。
一、玫瑰花的代码想象一下,你可以通过编写代码来产生一个美丽的玫瑰花,这是多么具有创意和实现感的事情啊!请看以下代码:#include <stdio.h>#include <math.h>#define PI 3.141592654int main(){double x, y, angle;for(y=1.5;y>-1.5;y-=0.1){for(x=-1.5;x<1.5;x+=0.05){angle = atan2(y,x);if (abs(angle-PI/2)<=0.15)//一行之间的角度间隔应该小于 PI/6,即 0.15,否则出现间断putchar('*');elseputchar(' ');}putchar('\n');}return 0;}代码中定义的x,y表示坐标系中的x轴、y轴坐标,angle表示该点与原点之间的倾斜角度。
然后通过双重循环来生成整个图形,内循环控制x轴坐标,外循环控制y轴坐标。
当标记出的角度周围小于0.15时,输出“*”,否则输出空格。
二、爱心的代码由于爱心是一个具有特殊形状的图案,因此编写码来产生它会更加有挑战性。
以下是一个C语言代码,可以画出一个有形的爱心:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>void heart(int**p, int o){int i, j, x, y;for (i = 0; i <= 180; i++){for (j = 0; j <= 180; j++){x = j - 90; y = i - 90;if (x*x + y * y <= 8100 && x*x + y * y >= 8100 - 180 * abs(sin(PI*x / 180)*sin(PI*x / 180)*sin(PI*x / 180))) p[o + y][o + x] = 1;}}}void run(int **p, int w, int h){int i, j;for (i = 0; i < h; i++){for (j = 0; j < w; j++)putchar(p[i][j] ? '*' : ' ');//'*'表示两个字符之间用星号分隔,输出图形putchar('\n');//输出回车符以结束该行的绘制}}int main(){int **p, i, j;p = (int**)malloc(200*sizeof(int*));for (i = 0; i < 200; i++)p[i] = (int*)malloc(200*sizeof(int));memset(p[0], 0, 200*200*sizeof(int));heart(p, 10);//执行绘制爱心函数run(p, 200, 200);for (i = 0; i < 200; i++)free(p[i]);free(p);return 0;}该代码使用malloc(动态内存分配)函数来定义二维数组,写入一个函数来生成爱心。
大型表白策划方案
![大型表白策划方案](https://img.taocdn.com/s3/m/bf3809a51b37f111f18583d049649b6648d70921.png)
大型表白策划方案每年的5月20日是一个浪漫的日子,非常适合表白和求婚的日子。
下面,小编给大家介绍一下表白策划范文4篇,欢迎大家阅读。
表白活动策划1一、活动背景表白日,一年中最浪漫的日子,这一天无限柔情和蜜意尽情释放,真诚的渴望与期待等待回答,心与心的碰撞,撞出永恒不熄的爱的火花。
情人节是一个典型的西方式情人节,但近年来已经成为我国青年人每年都企盼的节日,在这一天,情侣们都会安排很多活动来庆祝这个特殊的节日。
这样一来就使情人节情人节成了消费高峰。
很多商家都积极主动的抓住这个机会,搞各种各样的促销活动以期提高人气。
同样的我们也不例外,也要抓住这个机会。
二、活动名称:东方广场“爱就在身边”情人节真情联欢三、活动主题“玫瑰心情,情系你我”主题演绎要求:以“简单却让人印象深刻”为设计思路,结合情侣从相识相知到相恋相爱的情感历程,通过互动游戏穿插节目表演的形式,塑造情人节浪漫、温馨、浓厚的氛围,揭示爱情的真谛和表达表白活动策划2520浪漫表白策划一:520朵红玫瑰惊喜表白。
520表白日当天的13点14分是浪漫表白、求婚的经典时刻,5101314我爱你一生一世,男生定好520朵鲜艳的红玫瑰,在520当天的13点14分准时送到女生办公楼,并附上一句520表白浪漫的话,用热烈爱情的玫瑰向女生来一场浪漫表白策划吧!520浪漫表白策划二:520快闪表白。
提前策划好520表白日当天跳的舞蹈和播放的音乐,中午将女生约到广场或喷泉边,周围的路人都是你请来跳舞的舞者。
当约定的时间一到,动感的音乐响起,路人便在女生面前跳起舞来。
一舞结束,西装革履的男生捧着鲜花走到女生面前,深情向女生说520;。
520浪漫表白策划三:浪漫烛光晚餐表白。
浪漫优雅的西餐厅内摆放着红玫瑰,悠扬的小提琴演奏着古典乐曲,用餐完毕后的甜点里包含着一生只能定制一枚的DR钻戒,不需要多余的言语,一个深情的眼神便能让女生读懂你的520浪漫表白。
表白活动策划3管理学院创意表白作品征集大赛主办单位:管理学院团委承办单位:管理学院社团联合会一、活动主题:创意表白,大城小爱二、活动背景:1、在教育部要求丰富大学生生活的大背景下,为迎合大学生恋爱趋势,积极开展此次活动,让本院学生体验表白与创意结合的魅力,营造良好的大学氛围,丰富学生的感情世界。
c语言写的表白代码
![c语言写的表白代码](https://img.taocdn.com/s3/m/139853ba6aec0975f46527d3240c844768eaa05b.png)
c语言写的表白代码在程序员的世界里,用代码表达心意早已成为一种“时尚”。
而表白也是每个人都会经历的一段浪漫时光。
今天,我们就来学习一下如何用 C 语言写一段表白代码。
第一步,我们需要构思程序的框架,即程序的实现路径。
在此,我们定义一个字符串变量,用于存储表白的内容。
在 C 语言中,字符串变量需要使用字符数组来表示。
因此,我们需要定义一个字符数组来保存这个字符串。
代码如下:#include <stdio.h>int main(){char love[100];printf("请输入你的表白内容:\n");scanf("%s", love);printf("你的表白内容为:%s\n", love);return 0;}在上述代码中,我们定义了一个字符数组 love,用于存储用户输入的表白内容。
同时,使用 printf() 函数和 scanf() 函数打印输入提示和接收用户输入的表白内容。
第二步,我们需要将程序的实现路径拓展至界面上。
我们可以使用 ASCII 字符集中的特殊字符来制作简单的表情符号,增添程序的趣味性和可读性。
修改后的代码如下:#include <stdio.h>int main(){char love[100];printf("\n");printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf(" @@@@@@@@@@@@@@@@@@@@@\n");printf(" @@@@@@@@@@@@@@@@@@@@@@@@\n");printf(" @@@@@ Love You !@@@@@@@@@\n");printf(" @@@@@@@@@@@@@@@@@@@@@@@@\n");printf(" @@@@@@@@@@@@@@@@@@@@@@@@@@\n");printf(" @@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); printf(" @@@@@@@@@@@@@@@@@@@@@@@\n");printf("\n");printf("请输入你的表白内容:");scanf("%s", love);printf("你的表白内容为:%s\n", love);return 0;}在上述代码中,我们调用了 printf() 函数来打印 ASCII 字符集中的“ @}” 符号,来拓展界面的可读性和趣味性。
表白源代码
![表白源代码](https://img.taocdn.com/s3/m/da56df390b4c2e3f5727635d.png)
//////////////////
char ch[10];
int f[9][36]={ 0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,
0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,
Sleep ( stoptimeshort );
printf ( "%s","接" );
Sleep ( stoptimeshort );
0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,
1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,
1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,
0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,
0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,
0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1,
0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,
printf ( "%s","…\n" );
520简单表白代码(JS)
![520简单表白代码(JS)](https://img.taocdn.com/s3/m/f9256d9370fe910ef12d2af90242a8956becaa0e.png)
520简单表⽩代码(JS)这两天不知道咋了,迷迷糊糊的,突然知道今天是520的我,急急忙忙赶出个程序(新⼿,代码有点乱),发出来⼤家⼀起研究下(参考百度的)。
<!DOCTYPE html><html><head><meta charset="utf-8"><title>520</title><style>html, body{padding:0px; margin:0px; background:#222; font-family: 'Karla', sans-serif; color:#FFF; height:100%; overflow:hidden;}canvas {width:100%; height:100%;}#text,#text_520{font-family:'楷体'; color:rgb(255,255,3); font-size:20px; position:fixed; left:10%; top:10%;}#text_520{font-size:100px; top:50%; left:50%;}img{position:fixed; top:0; left:0; width:100%;}#last{font-size:12px; bottom:10px; left:50%; position:fixed;}/*@keyframes drop {0% {transform: translateY(-100px);opacity: 0;}90% {opacity: 1;transform:translateY(10px);}100% {transform:translateY(0px;)}}*/</style></head><body><canvas id="c"></canvas><div id="text"></div><div id="text_520">5 2 0</div><img src="./timg.jpg" class="img"/><div id="last">版权所有:李晓珂</div><script type="text/javascript" src="./jquery-1.11.0.min.js"></script><script type="text/javascript">function isIE(){var u = erAgent;if((u.indexOf("compatible") > -1 && u.indexOf("MSIE") > -1) || (u.indexOf("Trident") > -1 && u.indexOf("rv:11.0") > -1)){alert("该浏览器暂不⽀持,请更换浏览器");window.open('','_self');window.close();}var audio = document.createElement("audio");audio.setAttribute("src","./520-love.mp3");audio.setAttribute("autoplay","autoplay");}isIE();</script><script type="text/javascript">var textArr = ['I love three things in this world,','the sun ,the moon and you.','The sun for the day,','the moon for the night,','and you forever!','','If you were a teardrop,','in my eye,','for fear of losing you,','I would never cry.','And if the golden sun,','should cease to shine its light,','just one smile from you,','would make my whole world bright.'];var text_520 = document.getElementById('text_520');var height = (window.innerHeight - text_520.offsetHeight) / 2;var width = (window.innerWidth - text_520.offsetWidth) / 2;text_520.style.top = height + 'px';text_520.style.left = width + 'px';$('#text_520').hide();$('.img').hide();var m = 0;var n = 0;var text = document.getElementById('text');function typing(){if(m <= textArr[n].length) {text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1) + textArr[n].substr(m++,1) + '_'; setTimeout(typing,250);}else {if(n < textArr.length-1){text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1) + "<br />_";n++;m = 0;typing();}else {text.innerHTML = text.innerHTML.substring(0,text.innerHTML.length-1);$('#text').fadeOut(5000);setTimeout(function(){$('#text_520').fadeIn(5000);},7000);setTimeout(function(){$('#text_520').fadeOut(5000); },7000);setTimeout(function(){$('.img').fadeIn(50000);},15000)}}}setTimeout(typing,5000);var ctx = document.querySelector('canvas').getContext('2d');ctx.canvas.width = window.innerWidth;ctx.canvas.height = window.innerHeight;var sparks = [];var fireworks = [];var walker;fireworks.pop();var i = 10;while(i--) fireworks.push(new Firework(Math.random()*window.innerWidth, window.innerHeight*Math.random()));// setInterval(render, 1000/50);render();function render() {setTimeout(render, 1000/50);ctx.fillStyle = 'rgba(0, 0, 0, 0.2)';ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);// 上升效果for(var firework of fireworks) {if(firework.dead) continue;firework.move();firework.draw();}// 绽放效果for(var spark of sparks) {if(spark.dead) continue;spark.move();spark.draw();}if(Math.random() < 0.1) fireworks.push(new Firework());//ctx.height = ctx.height;}function Spark(x, y, color) {this.x = x;this.y = y;this.dir = Math.random() * (Math.PI*2);this.speed = Math.random() * 3 + 3;walker = new Walker({ radius: 20, speed: 0.25 });this.gravity = 0.25;this.dur = this.speed / 0.15;this.move = function() {this.dur--;if(this.dur < 0) this.dead = true;if(this.speed < 0) return;if(this.speed > 0) this.speed -= 0.15;walk = walker.step();this.x += Math.cos(this.dir + walk) * this.speed;this.y += Math.sin(this.dir + walk) * this.speed;this.y += this.gravity;this.gravity += 0.05;}this.draw = function() {drawCircle(this.x, this.y, 2, this.color);}}function Firework(x, y) {this.xmove = Math.random()*2 - 1;this.x = x || Math.random() * ctx.canvas.width;this.y = y || ctx.canvas.height;this.height = Math.random()*ctx.canvas.height/2;this.dead = false;this.color = randomColor();this.move = function() {this.x += this.xmove;if(this.y > this.height) this.y -= 4;else this.burst();}this.draw = function() {drawCircle(this.x, this.y, 3, this.color)}this.burst = function() {this.dead = truei = 100; while(i--) sparks.push(new Spark(this.x, this.y, this.color));sparks.pop();}}setTimeout(function (){window.open('','_self').close();},175000);/*// 清除两个数组function clear(){if(sparks!=null || fireworks!=null){sparks.pop();fireworks.pop();}var sparks = [];var fireworks = [];}setInterval(clear,100);*/function drawCircle(x, y, radius, color) {color = color || '#FFF';ctx.fillStyle = color;ctx.fillRect(x-radius/2, y-radius/2, radius, radius);}function randomColor(){return ['#6ae5ab','#88e3b2','#36b89b','#7bd7ec','#66cbe1'][Math.floor(Math.random() * 5)]; }function Walker(options){this.step = function(){this.direction = Math.sign(this.target) * this.speedthis.value += this.directionthis.targetthis.target -= this.directionthis.target = this.newTarget(): this.target = -this.value: this.target = this.newTarget()return this.direction}this.newTarget = function() {return Math.round(Math.random()*(this.radius*2)-this.radius) }this.start = 0this.value = 0this.radius = options.radiusthis.target = this.newTarget()this.direction = Math.sign(this.target)this.wander = options.wanderthis.speed = options.speed || 1}</script></body></html>。
表白程序(C++)
![表白程序(C++)](https://img.taocdn.com/s3/m/d8ff77e183d049649a665857.png)
菜鸟奉献你一个520表白神器爱情总是那么神圣,烂漫,每个人都会有无限的向往,即便是程序员(自我笑下),忽然我想起周星驰的那些话“曾经有一段爱情摆在我面前。
我希望是一万年”,于是我试着做了表白程序。
实现原理:原理比较的简单,主要是运用windows API来实现,程序初步实现的功能是显示文字,图像,歌曲(重复),燃放烟花(循环),程序的实现过程大概可以描述为烟花燃放的一个过程(初始化,上升,爆炸,循环),具体实现方法不再复述了,代码比较简单。
工具:VS2013 Eaxy(冬至版)[使用TC库,不是VC库,用Eaxy] 主要代码:#include "graphics.h"#include <conio.h>#include <math.h>#include <time.h>#include <stdio.h>#include <Mmsystem.h>#pragma comment ( lib, "Winmm.lib" )/***** 宏定义区******/#define NUM 13 // 烟花种类数量宏定义/***** 结构定义区**********/// 烟花结构struct FIRE{int r; // 当前爆炸半径int max_r; // 爆炸中心距离边缘最大半径int x, y; // 爆炸中心在窗口的坐标int cen_x, cen_y; // 爆炸中心相对图片左上角的坐标int width, height; // 图片的宽高int xy[240][240]; // 储存图片像素点bool show; // 是否绽放bool draw; // 开始输出像素点DWORD t1, t2, dt; // 绽放速度}Fire[NUM];// 烟花弹结构struct JET{int x, y; // 喷射点坐标int hx, hy; // 最高点坐标------将赋值给FIRE 里面的x, y int height; // 烟花高度bool shoot; // 是否可以发射DWORD t1, t2, dt; // 发射速度IMAGE img[2]; // 储存花弹一亮一暗图片byte n : 1; // 图片下标}Jet[NUM];/**** 函数申明区****/void Init(int); // 初始化烟花void Load(); // 加载烟花图片void Shoot(); // 发射烟花void Chose(DWORD&); // 筛选烟花void Style(DWORD&); // 发射样式void Show(DWORD*); // 绽放烟花// 主函数void main(){initgraph(1200, 800);srand(time(0));// 播放背景音乐mciSendString("open ./fire/bk.mp3 alias bk", 0, 0, 0);mciSendString("play bk repeat", 0, 0, 0);//setfillstyle(0);settextstyle(50, 0, "楷体");setcolor(YELLOW);outtextxy(480, 100, "My Dear");outtextxy(400, 200, "愿你悲伤有人分担!");outtextxy(400, 280, "愿你孤独有人陪伴!");getchar();cleardevice();settextstyle(25, 0, "楷体");outtextxy(400, 250, "曾经");outtextxy(400, 300, "有一份真挚的爱情摆在我的面前");outtextxy(400, 350, "我没有珍惜");outtextxy(400, 400, "直到失去了才后悔莫及");outtextxy(400, 450, "世间最痛苦的事情莫过于此");outtextxy(400, 500, "如果上天能给我一个在来一次的机会"); outtextxy(400, 550, "我会对那个女孩说");outtextxy(400, 600, "我爱你,一万年");outtextxy(700, 660, "——谢新明");getchar();DWORD t1 = timeGetTime(); // 筛选烟花计时DWORD st1 = timeGetTime(); // 播放花样计时DWORD* pMem = GetImageBuffer(); // 获取窗口显存指针for (int i = 0; i < NUM; i++) // 初始化烟花{Init(i);}Load(); // 将烟花图片信息加载进相应结构中BeginBatchDraw(); // 开始批量绘图while (!kbhit()){Sleep(10);// 随机选择4000 个像素点擦除for (int clr = 0; clr < 1000; clr++){for (int j = 0; j < 2; j++){int px1 = rand() % 1200;int py1 = rand() % 800;if (py1 < 799) // 防止越界pMem[py1 * 1200 + px1] = pMem[py1 * 1200 + px1 + 1] = BLACK;// 对显存赋值擦出像素点}}Chose(t1); // 筛选烟花Shoot(); // 发射烟花Show(pMem); // 绽放烟花Style(st1); // 花样发射FlushBatchDraw(); // 显示前面的所有绘图操作}}// 初始化烟花参数void Init(int i){// 分别为:烟花中心到图片边缘的最远距离、烟花中心到图片左上角的距离(x、y) 两个分量int r[13] = { 120, 120, 155, 123, 130, 147, 138, 138, 130, 135, 140, 132, 155 };int x[13] = { 120, 120, 110, 117, 110, 93, 102, 102, 110, 105, 100, 108, 110 };int y[13] = { 120, 120, 85, 118, 120, 103, 105, 110, 110, 120, 120, 104, 85 };/**** 初始化烟花*****/Fire[i].x = 0; // 烟花中心坐标Fire[i].y = 0;Fire[i].width = 240; // 图片宽Fire[i].height = 240; // 图片高Fire[i].max_r = r[i]; // 最大半径Fire[i].cen_x = x[i]; // 中心距左上角距离Fire[i].cen_y = y[i];Fire[i].show = false; // 是否绽放Fire[i].dt = 5; // 绽放时间间隔Fire[i].t1 = timeGetTime();Fire[i].r = 0; // 从0 开始绽放/**** 初始化烟花弹*****/Jet[i].x = -240; // 烟花弹左上角坐标Jet[i].y = -240;Jet[i].hx = -240; // 烟花弹发射最高点坐标Jet[i].hy = -240;Jet[i].height = 0; // 发射高度Jet[i].t1 = timeGetTime();Jet[i].dt = rand() % 10; // 发射速度时间间隔Jet[i].n = 0; // 烟花弹闪烁图片下标Jet[i].shoot = false; // 是否发射// 加载图片void Load(){/**** 储存烟花的像素点颜色****/IMAGE fm, gm;loadimage(&fm, "./fire/flower.jpg", 3120, 240);for (int i = 0; i < 13; i++){SetWorkingImage(&fm);getimage(&gm, i * 240, 0, 240, 240);SetWorkingImage(&gm);for (int a = 0; a < 240; a++)for (int b = 0; b < 240; b++)Fire[i].xy[a][b] = getpixel(a, b);}/**** 加载烟花弹************/IMAGE sm;loadimage(&sm, "./fire/shoot.jpg", 200, 50);for (int i = 0; i < 13; i++){SetWorkingImage(&sm);int n = rand() % 5;getimage(&Jet[i].img[0], n * 20, 0, 20, 50); // 暗getimage(&Jet[i].img[1], (n + 5) * 20, 0, 20, 50); // 亮}SetWorkingImage(); // 设置回绘图窗口}// 在一定范围内筛选可发射的烟花,并初始化发射参数,输出烟花弹到屏幕,播放声音void Chose(DWORD& t1){DWORD t2 = timeGetTime();if (t2 - t1 > 100){int n = rand() % 20;if (n < 13 && Jet[n].shoot == false && Fire[n].show == false){/**** 重置烟花弹,预备发射*****/Jet[n].x = rand() % 1200;Jet[n].y = rand() % 100 + 600;Jet[n].hx = Jet[n].x;Jet[n].hy = rand() % 400;Jet[n].height = Jet[n].y - Jet[n].hy;Jet[n].shoot = true;putimage(Jet[n].x, Jet[n].y, &Jet[n].img[Jet[n].n], SRCINVERT);/**** 播放每个烟花弹的声音*****/char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/shoot.mp3 alias s%d", n);sprintf(c2, "play s%d", n);sprintf(c3, "close n%d", n);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);}t1 = t2;}}// 扫描烟花弹并发射void Shoot(){for (int i = 0; i < 13; i++){Jet[i].t2 = timeGetTime();if (Jet[i].t2 - Jet[i].t1 > Jet[i].dt && Jet[i].shoot == true){/**** 烟花弹的上升*****/putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);if (Jet[i].y > Jet[i].hy).{Jet[i].n++;Jet[i].y -= 5;}putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);/**** 上升到高度的3 / 4,减速*****/if ((Jet[i].y - Jet[i].hy) * 4 < Jet[i].height)Jet[i].dt = rand() % 4 + 10;/**** 上升到最大高度*****/if (Jet[i].y <= Jet[i].hy){// 播放爆炸声char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/bomb.wav alias n%d", i);sprintf(c2, "play n%d", i);sprintf(c3, "close s%d", i);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT); // 擦掉烟花弹Fire[i].x = Jet[i].hx + 10;// 在烟花弹中间爆炸Fire[i].y = Jet[i].hy;// 在最高点绽放Fire[i].show = true; // 开始绽放Jet[i].shoot = false; // 停止发射}Jet[i].t1 = Jet[i].t2;}}}// 显示花样void Style(DWORD& st1){.DWORD st2 = timeGetTime();if (st2 - st1 > 20000) // 一首歌的时间{// 心形坐标int x[13] = { 60, 75, 91, 100, 95, 75, 60, 45, 25, 15, 25, 41, 60 };int y[13] = { 65, 53, 40, 22, 5, 4, 20, 4, 5, 22, 40, 53, 65 };for (int i = 0; i < NUM; i++){//cleardevice();/**** 规律分布烟花弹***/Jet[i].x = x[i] * 10;Jet[i].y = (y[i] + 75) * 10;Jet[i].hx = Jet[i].x;Jet[i].hy = y[i] * 10;Jet[i].height = Jet[i].y - Jet[i].hy;Jet[i].shoot = true;Jet[i].dt = 7;putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT); // 显示烟花弹/**** 设置烟花参数***/Fire[i].x = Jet[i].x + 10;Fire[i].y = Jet[i].hy;Fire[i].show = false;Fire[i].r = 0;/**** 播放发射声音***/char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/shoot.mp3 alias s%d", i);sprintf(c2, "play s%d", i);sprintf(c3, "close n%d", i);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);}st1 = st2;}}// 绽放烟花void Show(DWORD* pMem)。
十款代码表白小特效一个比一个浪漫赶紧收藏起来吧!!!
![十款代码表白小特效一个比一个浪漫赶紧收藏起来吧!!!](https://img.taocdn.com/s3/m/33185d5211a6f524ccbff121dd36a32d7275c76d.png)
十款代码表白小特效一个比一个浪漫赶紧收藏起来吧代码表白小特效,是一种通过编写代码来展现浪漫的方式。
在这个数字化时代,人们越来越喜欢用创意的方式来表达自己的情感,而代码表白小特效正是其中一种新颖而浪漫的方式。
今天,我将为大家介绍十款代码表白小特效,希望能给大家带来一些灵感和启发。
1. 爱心飘落特效。
```html。
<!DOCTYPE html>。
<html>。
<head>。
<style>。
body {。
background-color: #000;overflow: hidden;}。
.heart {。
position: absolute;width: 10px;height: 10px;background-color: #f00;transform: rotate(-45deg);animation: love 1s infinite;}。
@keyframes love {。
0% {。
top: 0;left: 0;}。
100% {。
top: 100%;left: 100%;}。
}。
</style>。
</head>。
<body>。
<script>。
function createHeart() {。
const heart = document.createElement('div');heart.classList.add('heart');heart.style.top = Math.random() 100 + 'vh';heart.style.left = Math.random() 100 + 'vw';document.body.appendChild(heart);setTimeout(() => {。
heart.remove();}, 2000);}。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
菜鸟奉献你一个520表白神器爱情总是那么神圣,烂漫,每个人都会有无限的向往,即便是程序员(自我笑下),忽然我想起周星驰的那些话“曾经有一段爱情摆在我面前。
我希望是一万年”,于是我试着做了表白程序。
实现原理:原理比较的简单,主要是运用windows API来实现,程序初步实现的功能是显示文字,图像,歌曲(重复),燃放烟花(循环),程序的实现过程大概可以描述为烟花燃放的一个过程(初始化,上升,爆炸,循环),具体实现方法不再复述了,代码比较简单。
工具:VS2013 Eaxy(冬至版)[使用TC库,不是VC库,用Eaxy]主要代码:#include "graphics.h"#include <conio.h>#include <math.h>#include <time.h>#include <stdio.h>#include <Mmsystem.h>#pragma comment ( lib, "Winmm.lib" )/***** 宏定义区******/#define NUM13// 烟花种类数量宏定义/***** 结构定义区**********/// 烟花结构struct FIRE{int r;// 当前爆炸半径int max_r;// 爆炸中心距离边缘最大半径int x, y;// 爆炸中心在窗口的坐标int cen_x, cen_y;// 爆炸中心相对图片左上角的坐标int width, height;// 图片的宽高int xy[240][240];// 储存图片像素点bool show;// 是否绽放bool draw;// 开始输出像素点DWORD t1, t2, dt;// 绽放速度}Fire[NUM];// 烟花弹结构struct JET{int x, y;// 喷射点坐标int hx, hy;// 最高点坐标------将赋值给FIRE 里面的x, y int height;// 烟花高度bool shoot;// 是否可以发射DWORD t1, t2, dt;// 发射速度IMAGE img[2];// 储存花弹一亮一暗图片byte n : 1;// 图片下标}Jet[NUM];/**** 函数申明区****/void Init(int);// 初始化烟花void Load();// 加载烟花图片void Shoot();// 发射烟花void Chose(DWORD&);// 筛选烟花void Style(DWORD&);// 发射样式void Show(DWORD*);// 绽放烟花// 主函数void main(){initgraph(1200, 800);srand(time(0));// 播放背景音乐mciSendString("open ./fire/bk.mp3 alias bk", 0, 0, 0);mciSendString("play bk repeat", 0, 0, 0);//setfillstyle(0);settextstyle(50, 0, "楷体");setcolor(YELLOW);outtextxy(480, 100, "My Dear");outtextxy(400, 200, "愿你悲伤有人分担!");outtextxy(400, 280, "愿你孤独有人陪伴!");getchar();cleardevice();settextstyle(25, 0, "楷体");outtextxy(400, 250, "曾经");outtextxy(400, 300, "有一份真挚的爱情摆在我的面前");outtextxy(400, 350, "我没有珍惜");outtextxy(400, 400, "直到失去了才后悔莫及");outtextxy(400, 450, "世间最痛苦的事情莫过于此");outtextxy(400, 500, "如果上天能给我一个在来一次的机会"); outtextxy(400, 550, "我会对那个女孩说");outtextxy(400, 600, "我爱你,一万年");outtextxy(700, 660, "——谢新明");getchar();DWORD t1 = timeGetTime();// 筛选烟花计时DWORD st1 = timeGetTime();// 播放花样计时DWORD* pMem = GetImageBuffer();// 获取窗口显存指针for (int i = 0; i < NUM; i++)// 初始化烟花{Init(i);}Load();// 将烟花图片信息加载进相应结构中BeginBatchDraw();// 开始批量绘图while (!kbhit()){Sleep(10);// 随机选择4000 个像素点擦除for (int clr = 0; clr < 1000; clr++){for (int j = 0; j < 2; j++){int px1 = rand() % 1200;int py1 = rand() % 800;if (py1 < 799)// 防止越界pMem[py1 * 1200 + px1] = pMem[py1 * 1200 + px1 + 1] = BLACK;// 对显存赋值擦出像素点}}Chose(t1);// 筛选烟花Shoot();// 发射烟花Show(pMem);// 绽放烟花Style(st1);// 花样发射FlushBatchDraw();// 显示前面的所有绘图操作}}// 初始化烟花参数void Init(int i){// 分别为:烟花中心到图片边缘的最远距离、烟花中心到图片左上角的距离(x、y) 两个分量int r[13] = { 120, 120, 155, 123, 130, 147, 138, 138, 130, 135, 140, 132, 155 };int x[13] = { 120, 120, 110, 117, 110, 93, 102, 102, 110, 105, 100, 108, 110 };int y[13] = { 120, 120, 85, 118, 120, 103, 105, 110, 110, 120, 120, 104, 85 };/**** 初始化烟花*****/Fire[i].x = 0;// 烟花中心坐标Fire[i].y = 0;Fire[i].width = 240;// 图片宽Fire[i].height = 240;// 图片高Fire[i].max_r = r[i];// 最大半径Fire[i].cen_x = x[i];// 中心距左上角距离Fire[i].cen_y = y[i];Fire[i].show = false;// 是否绽放Fire[i].dt = 5;// 绽放时间间隔Fire[i].t1 = timeGetTime();Fire[i].r = 0;// 从0 开始绽放/**** 初始化烟花弹*****/Jet[i].x = -240;// 烟花弹左上角坐标Jet[i].y = -240;Jet[i].hx = -240;// 烟花弹发射最高点坐标Jet[i].hy = -240;Jet[i].height = 0;// 发射高度Jet[i].t1 = timeGetTime();Jet[i].dt = rand() % 10;// 发射速度时间间隔Jet[i].n = 0;// 烟花弹闪烁图片下标Jet[i].shoot = false;// 是否发射// 加载图片void Load(){/**** 储存烟花的像素点颜色****/IMAGE fm, gm;loadimage(&fm, "./fire/flower.jpg", 3120, 240);for (int i = 0; i < 13; i++){SetWorkingImage(&fm);getimage(&gm, i * 240, 0, 240, 240);SetWorkingImage(&gm);for (int a = 0; a < 240; a++)for (int b = 0; b < 240; b++)Fire[i].xy[a][b] = getpixel(a, b);}/**** 加载烟花弹************/IMAGE sm;loadimage(&sm, "./fire/shoot.jpg", 200, 50);for (int i = 0; i < 13; i++){SetWorkingImage(&sm);int n = rand() % 5;getimage(&Jet[i].img[0], n * 20, 0, 20, 50);// 暗getimage(&Jet[i].img[1], (n + 5) * 20, 0, 20, 50);// 亮}SetWorkingImage();// 设置回绘图窗口}// 在一定范围内筛选可发射的烟花,并初始化发射参数,输出烟花弹到屏幕,播放声音void Chose(DWORD& t1){DWORD t2 = timeGetTime();if (t2 - t1 > 100){int n = rand() % 20;if (n < 13 && Jet[n].shoot == false && Fire[n].show == false){/**** 重置烟花弹,预备发射*****/Jet[n].x = rand() % 1200;Jet[n].y = rand() % 100 + 600;Jet[n].hx = Jet[n].x;Jet[n].hy = rand() % 400;Jet[n].height = Jet[n].y - Jet[n].hy;Jet[n].shoot = true;putimage(Jet[n].x, Jet[n].y, &Jet[n].img[Jet[n].n], SRCINVERT);/**** 播放每个烟花弹的声音*****/char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/shoot.mp3 alias s%d", n);sprintf(c2, "play s%d", n);sprintf(c3, "close n%d", n);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);}t1 = t2;}}// 扫描烟花弹并发射void Shoot(){for (int i = 0; i < 13; i++){Jet[i].t2 = timeGetTime();if (Jet[i].t2 - Jet[i].t1 > Jet[i].dt && Jet[i].shoot == true){/**** 烟花弹的上升*****/putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);if (Jet[i].y > Jet[i].hy){Jet[i].n++;Jet[i].y -= 5;}putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);/**** 上升到高度的3 / 4,减速*****/if ((Jet[i].y - Jet[i].hy) * 4 < Jet[i].height)Jet[i].dt = rand() % 4 + 10;/**** 上升到最大高度*****/if (Jet[i].y <= Jet[i].hy){// 播放爆炸声char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/bomb.wav alias n%d", i);sprintf(c2, "play n%d", i);sprintf(c3, "close s%d", i);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);// 擦掉烟花弹Fire[i].x = Jet[i].hx + 10;// 在烟花弹中间爆炸Fire[i].y = Jet[i].hy;// 在最高点绽放Fire[i].show = true;// 开始绽放Jet[i].shoot = false;// 停止发射}Jet[i].t1 = Jet[i].t2;}}}// 显示花样void Style(DWORD& st1){DWORD st2 = timeGetTime();if (st2 - st1 > 20000)// 一首歌的时间{// 心形坐标int x[13] = { 60, 75, 91, 100, 95, 75, 60, 45, 25, 15, 25, 41, 60 };int y[13] = { 65, 53, 40, 22, 5, 4, 20, 4, 5, 22, 40, 53, 65 };for (int i = 0; i < NUM; i++){//cleardevice();/**** 规律分布烟花弹***/Jet[i].x = x[i] * 10;Jet[i].y = (y[i] + 75) * 10;Jet[i].hx = Jet[i].x;Jet[i].hy = y[i] * 10;Jet[i].height = Jet[i].y - Jet[i].hy;Jet[i].shoot = true;Jet[i].dt = 7;putimage(Jet[i].x, Jet[i].y, &Jet[i].img[Jet[i].n], SRCINVERT);// 显示烟花弹/**** 设置烟花参数***/Fire[i].x = Jet[i].x + 10;Fire[i].y = Jet[i].hy;Fire[i].show = false;Fire[i].r = 0;/**** 播放发射声音***/char c1[50], c2[30], c3[30];sprintf(c1, "open ./fire/shoot.mp3 alias s%d", i);sprintf(c2, "play s%d", i);sprintf(c3, "close n%d", i);mciSendString(c3, 0, 0, 0);mciSendString(c1, 0, 0, 0);mciSendString(c2, 0, 0, 0);}st1 = st2;}}// 绽放烟花void Show(DWORD* pMem){// 烟花个阶段绽放时间间隔,制作变速绽放效果int drt[16] = { 5, 5, 5, 5, 5, 6, 25, 25, 25, 25, 55, 55, 55, 55, 55 };for (int i = 0; i < NUM; i++){Fire[i].t2 = timeGetTime();// 增加爆炸半径,绽放烟花,增加时间间隔做变速效果if (Fire[i].t2 - Fire[i].t1 > Fire[i].dt && Fire[i].show == true){if (Fire[i].r < Fire[i].max_r){Fire[i].r++;Fire[i].dt = drt[Fire[i].r / 10];Fire[i].draw = true;}if (Fire[i].r >= Fire[i].max_r - 1){Fire[i].draw = false;Init(i);}Fire[i].t1 = Fire[i].t2;}// 如果该号炮花可爆炸,根据当前爆炸半径画烟花,颜色值接近黑色的不输出。