文章目錄
- 一、愛心表白
- 二、愿望清單
- 三、禮物
- 四、文案
我想跟你一起生活,在某個小鎮,共享無盡的黃昏,和綿綿不絕的鐘聲,
愛意東升西落,浪漫至死不渝,

以此文表達對 CSDN 征文活動的支持,生活需要一些儀式感,浪漫至死不渝,
一、愛心表白
MATLAB繪制 3D 愛心:
clear;
[x,y,z] = meshgrid(linspace(-1.3,1.3));
val=(x.^2 + (9/4)*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (1/9)*y.^2.*z.^3;
p = patch(isosurface(x, y, z, val, 0));
isonormals(x, y, z, val, p);
set(p, 'FaceColor', 'red', 'EdgeColor', 'none');
axis equal;view(-10, 24);
colormap(hot);axis off;
camlight;rotate3d on;
效果如下:

C語言代碼列印愛心:
#include<stdio.h>
int main(void)
{
float a, x, y;
for(y=1.5f; y>-1.5f; y-=0.1f)
{
for(x=-1.5f; x<1.5f; x+=0.05f)
{
a = x*x+y*y-1;
char ch = a*a*a-x*x*y*y*y<=0.0f?'*':' ';
putchar(ch);
}
printf("\n");
}
return 0;
}
效果如下:

二、愿望清單
用 Vue.js 和 Semantic-UI 做一個愿望清單,記錄以后想和喜歡的人一起做的事,節日里總要有些溫柔的夢想吧,
<html data-framework="vue">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>TODOS - A wish list</title>
<link href="static/semantic.min.css" rel="stylesheet">
<link href="static/style.css" rel="stylesheet">
</head>
<body>
<div id="todos" class="ui text container" style="background: #F3F3F4;padding: 0 14px; min-height: 100%;">
<h1 class="ui centered grey header" style="font-size: 5em;">
<span class="pink text">A Wish List</span>
</h1>
<div class="ui stacked segment" style="padding: 14px;">
<div class="ui fluid right action input">
<input type="text" placeholder="想和喜歡的人一起做點什么?"
v-model="newTitle"
autofocus autocomplete="off"
@keyup.enter="addTask">
<button class="ui teal icon button"
@click="addTask">
<i class="plus icon"></i>
</button>
</div>
<div class="ui huge middle aligned divided selection list">
<div class="item" v-for="task in filterTasks" :class="{ editing: task == editedTask }">
<div class="right floated content">
<i class="red remove icon" @click='removeTask(task);'></i>
</div>
<div class="content" @dblclick="editTask(task)">
<div class="ui checkbox" >
<input type="checkbox" name="example" v-model="task.completed">
<label class="header"><span class="grey text">{{ task.title }}</span></label>
</div>
<div class="ui mini transparent input">
<input class="edit" type="text"
v-model="task.title"
v-task-focus="task == editedTask"
@blur="saveEdit(task)"
@keyup.enter="saveEdit(task)"
@keyup.esc="cancelEdit(task)" >
</div>
</div>
</div>
</div>
<div class="ui green divider" v-show="tasks.length"></div>
<div class="ui grid" v-show="tasks.length">
<div class="three wide column">
<span class="grey text">
<span class="green text" v-text="remaining"> </span><span class="grey text"> Left </span>
</span>
</div>
<div class="eight wide column" style="padding: 0px;">
<div class="ui mini secondary menu" style="margin-top: 8px;">
<a @click="filterTask('all')" class="item" :class="{ active: visibility == 'all' }"><span class="pink text"> All </span></a>
<a @click="filterTask('active')" class="item" :class="{ active: visibility == 'active' }"><span class="pink text"> Wait </span></a>
<a @click="filterTask('completed')" class="item" :class="{ active: visibility == 'completed' }"><span class="pink text"> Completed </span></a>
</div>
</div>
<div class="five wide column">
<a class="clear" href="#" @click="removeCompleted($event)"><span class="red text">Clear</span></a>
</div>
</div>
</div>
<div class="intro">
<span class="red text">A wish list of things you want to do with the people you love</span>
</div>
</div>
<span class="text"> </span>
<br>
<br>
</body>
<script src="static/js/vue.js"></script>
<script src="static/app.js"></script>
</html>
效果如下:

使用 Vue.js 和 Semantic-UI 做一個愿望清單,記錄以后想和喜歡的人一起做的事,在輸入框中寫入想和喜歡的人一起做的事,然后按 Enter 鍵或者點擊右邊的 “+”,即可將資料添加進去,下方 3 Left 表示還有 3 個愿望未實作,點擊 All 查看所有的愿望,點擊 Wait 查看未實作的愿望,點擊 Completed 查看已實作的愿望,錯誤添加進去的內容可以先選定,然后使用 Clear 清除掉再重新添加,或者滑鼠懸停在那一條內容上,出現 ? 然后點擊洗掉再重新添加,界面簡潔美觀,使用方便,
三、禮物
所有的晦暗都留給過往,從遇見你開始,凜冬散盡,星河長明,


代碼實作如下:
import tkinter as tk
import random
import cv2
import numpy as np
from PIL import Image, ImageTk
import os
win = tk.Tk()
win.title('情人節禮物')
win.geometry('600x500')
def get_image(file_nam, width, height): # 為tkinter界面設定背景圖片
im = Image.open(file_nam).resize((width, height))
return ImageTk.PhotoImage(im)
def show_1(): # 送你佳句
file = os.listdir(r'./picture/words')
choice = r'./picture/words' + '/' + random.choice(file)
cv_img = cv2.imdecode(np.fromfile(choice, dtype=np.uint8), -1)
new_img = cv2.resize(cv_img, None, fx=1, fy=1)
cv2.imshow('words', new_img)
# 視窗等待命令 0表示無限等待
cv2.waitKey(3600)
cv2.destroyAllWindows()
def show_2(): # 送你美景
file = os.listdir(r'./picture/scenary')
choice = r'./picture/scenary' + '/' + random.choice(file)
cv_img = cv2.imdecode(np.fromfile(choice, dtype=np.uint8), -1)
new_img = cv2.resize(cv_img, None, fx=0.5, fy=0.5)
cv2.imshow('scenary', new_img)
# 視窗等待命令 0表示無限等待
cv2.waitKey(2000)
cv2.destroyAllWindows()
def show_3(): # 流星許愿
file = r'./picture/Meteor wish' + '/' + random.choice(os.listdir(r'./picture/Meteor wish'))
cap = cv2.VideoCapture(file)
while True:
ret, frame = cap.read()
if not ret:
break
cv2.imshow('best wishes', frame)
cv2.waitKey(25)
cv2.destroyAllWindows()
def show_4(): # 你是我的獨家記憶
cap = cv2.VideoCapture('test.flv')
while True:
ret, frame = cap.read()
if not ret:
break
new_img = cv2.resize(frame, None, fx=0.5, fy=0.5)
cv2.imshow('you are my only', new_img)
cv2.waitKey(25)
cv2.destroyAllWindows()
# 畫布 設定背景圖片
canvas = tk.Canvas(win, height=600, width=800)
im_root = get_image(r'./picture/best_wish/bg.png', width=800, height=600)
canvas.create_image(400, 300, image=im_root)
canvas.pack()
# Entry 單行文本 采集鍵盤輸入
L = tk.Label(win, bg="#9400D3", text="執子之手,與子偕老,", font=("KaiTi", 26), width=25, height=3)
L.place(x=74, y=0)
# 按鈕
a1 = tk.Button(win, bg='#FF1493', text='送你佳句', font=("KaiTi", 16), width=25, height=2, command=show_1)
a1.place(x=160, y=120)
a2 = tk.Button(win, bg='#FF1493', text='送你美景', font=("KaiTi", 16), width=25, height=2, command=show_2)
a2.place(x=160, y=210)
a3 = tk.Button(win, bg='#FF1493', text='流星許愿', font=("KaiTi", 16), width=25, height=2, command=show_3)
a3.place(x=160, y=300)
a4 = tk.Button(win, bg='#FF1493', text='你是我的獨家記憶', font=("KaiTi", 16), width=25, height=2, command=show_4)
a4.place(x=160, y=390)
image_label = tk.Label(win)
image_label.pack()
# 進入訊息回圈
win.mainloop()
效果如下:



送你佳句里,可以準備一些表白的文案或者女朋友喜歡的文案;送你美景里,可以網上找一些地方美景圖片,比如香格里拉、稻城亞丁,很適合情侶一起去旅游,流星許愿里,用了流星雨的視頻;你是我的獨家記憶里,當然記錄和喜歡的人在一起的點點滴滴啦,
四、文案
其實努力也沒那么辛苦,想著以后的日子可以過得那樣平靜和有力量,可以一步步靠近喜歡的人,可以輕松擁有自己喜歡的東西,就能在疲憊的生活中找到甜,
我想跟你一起生活,在某個小鎮,共享無盡的黃昏,和綿綿不絕的鐘聲,
朝暮與歲月并往,愿我們一同行至天光,
我從來都是很黯淡的人,是你給了我滿天星光,
縱使生活沒那么容易,我還是想把你放在未來里,一生歡喜,不為世俗所及,
你的存在對我來說,很重要!
愛和被愛,都會讓我們變得更加溫柔和透徹,
兩個人肩并肩地走路本身就是件令人愉快的事情,真正喜歡的人和事都值得我去堅持,
所有的晦暗都留給過往,從遇見你開始,凜冬散盡,星河長明,
沒有狗糧,也沒有秀恩愛,很良心的文章,對不對?少俠點贊支持一下下吧,下個情人節脫單的幸運兒就有你,
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/260106.html
標籤:其他
上一篇:C語言實體練習(上)
