通過(guò)代碼敲出櫻花開(kāi)放可以用Matlab或者C語(yǔ)言進(jìn)行,主要是編寫(xiě)相關(guān)程序。目前由武漢大學(xué)學(xué)生開(kāi)發(fā)的櫻花開(kāi)放Python源代碼已經(jīng)正式公布,用戶(hù)將圖中cv_2.cv_3.cv_4依次執(zhí)行即可。值得注意的是這段由Python代碼組成的櫻花延時(shí)開(kāi)放美景由無(wú)數(shù)個(gè)“武漢加油”組成,每個(gè)字都是一個(gè)像素點(diǎn)。
創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站制作、網(wǎng)站建設(shè)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶(hù)于互聯(lián)網(wǎng)時(shí)代的穆棱網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!
作為具有地標(biāo)意義的武大櫻花,雖然在今年疫情防控期間暫停對(duì)外開(kāi)放,但坐在家中的你,照樣可以欣賞到櫻花爭(zhēng)相盛開(kāi)的美景——近日,武漢大學(xué)信息管理與信息系統(tǒng)大二學(xué)生朱永春,用Python代碼敲出了櫻花開(kāi)放。
無(wú)數(shù)個(gè)“武漢加油”匯聚在一起,每個(gè)字都是一個(gè)像素點(diǎn),@武漢大學(xué) 信管院學(xué)生用代碼敲出延時(shí)開(kāi)放的一朵櫻花??匆欢浠ㄩ_(kāi),等花開(kāi)成海,沒(méi)有一個(gè)春天不會(huì)到來(lái)。
值得注意的是這段由Matlab代碼組成的櫻花延時(shí)開(kāi)放美景由無(wú)數(shù)個(gè)“武漢加油”組成,每個(gè)字都是一個(gè)像素點(diǎn)。
2020年3月19日消息受目前新冠病毒疫情影響,武漢大學(xué)先前開(kāi)通了在線直播的方式讓全國(guó)游客可以“云賞櫻”,同時(shí)武漢大學(xué)的學(xué)生們還將武大櫻花美景“融合”到代碼中。
是武漢大學(xué)信管學(xué)院朱永春同學(xué)用Python所創(chuàng)作,據(jù)朱同學(xué)介紹,寫(xiě)代碼的時(shí)間總共大概花了三四個(gè)小時(shí),因?yàn)槠綍r(shí)有這樣的想法,剛好靈感閃現(xiàn),就想到用這種方式來(lái)給武漢加油。
由武漢大學(xué)學(xué)生開(kāi)發(fā)的櫻花開(kāi)放Python源代碼已經(jīng)正式公布,用戶(hù)將圖中cv_2.cv_3.cv_4依次執(zhí)行即可。
值得注意的是這段由Python代碼組成的櫻花延時(shí)開(kāi)放美景由無(wú)數(shù)個(gè)“武漢加油”組成,每個(gè)字都是一個(gè)像素點(diǎn)。
直接將代碼復(fù)制就能運(yùn)行。畫(huà)的是一只烏龜
package Draw;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
public class Tortoise1 {
public static void main(String args[]){
Frame w=new Frame();
w.setSize(1280,800);
TortoisePanel1 tp=new TortoisePanel1();
w.add(tp);
w.addMouseListener(tp);
tp.addMouseListener(tp);
w.addMouseMotionListener(tp);
tp.addMouseMotionListener(tp);
Thread? t=new Thread(tp);
t.start();
w.show();
}
}
class TortoisePanel1 extends Panel implements MouseListener,MouseMotionListener,Runnable{
int x = 30;
int y = 30 ;
int mx = 0;
int my = 0;
int flag=-1;
boolean b = true ;
public void paint(Graphics g){
super.paint(g) ;
this.setBackground(Color.LIGHT_GRAY) ;
if (b){
g.setColor(new Color( 80 , 180 , 80 )) ; //尾巴
g.fillOval( 140+x , 285+y , 150 , 150 ) ;
g.setColor(Color.LIGHT_GRAY) ;
g.fillOval( 155+x , 300+y , 140 , 140) ;
g.fillOval( 195+x , 260+y , 200 ,240 ) ;
g.setColor(new Color( 80 , 180 , 80 )) ;
g.fillOval( 145+x , 355+y , 40 , 40) ;
g.setColor(Color.LIGHT_GRAY) ;
g.fillOval( 157+x , 367+y , 15 , 15) ;
}else{
g.setColor(new Color( 80 , 180 , 80)) ; //尾巴
g.fillOval(13+x , 260+y , 150 , 150) ;
g.setColor(Color.LIGHT_GRAY) ;
g.fillOval(3+x , 265+y , 143 , 143) ;
g.setColor(new Color( 80 , 180 , 80)) ;
g.fillOval(100+x,353+y,40,40) ;
g.setColor(Color.LIGHT_GRAY) ;
g.fillOval(113+x , 365+y , 15 , 15) ;
}
if (b){
g.setColor(new Color(80,180,80)) ; //頭
g.fillOval( 120+x , 80+y , 60 , 100 ) ;
g.setColor(Color.WHITE) ;
g.fillOval( 130+x ,90+y , 10 ,10 ) ; //左眼
g.fillOval( 160+x ,90+y , 10 ,10 ) ; //右眼
g.setColor(Color.BLACK) ;
g.fillOval( 130+x ,90+y , 8 ,8 ) ; //左眼珠
g.fillOval( 160+x ,90+y , 8 ,8 ) ; //右眼珠
}else{
g.setColor(new Color(80,180,80)) ; //頭
g.fillOval( 120+x , 80+y , 60 , 100 ) ;
g.setColor(new Color(200,0,0)) ; //嘴
g.fillOval( 130+x , 100+y , 40 ,50 ) ;
g.setColor(new Color(80,180,80)) ;
g.fillOval( 130+x , 80+y , 40 ,50 ) ;
g.setColor(Color.BLACK) ;
g.drawLine( 143+x ,83+y , 140+x , 90+y ) ; //鼻子
g.drawLine( 158+x ,83+y , 160+x , 90+y ) ;
}
if (b){
g.setColor(new Color(80,180,80)) ;
g.fillOval( 50+x ,140+y ,50 , 70 ) ; //左爪
g.fillOval( 200+x ,140+y ,50 , 70 ) ; //右爪
g.fillOval( 50+x ,280+y ,50 , 70 ) ; //左后爪
g.fillOval( 200+x ,280+y ,50 , 70 ) ; //右后爪
}else{
g.setColor(new Color(80,180,80)) ; //左爪
g.fillOval( 50+x ,140+y ,50 , 70 ) ;
g.setColor(new Color(250,100,150)) ; //左指頭
g.fillOval( 55+x ,155+y ,5 , 7 ) ;
g.fillOval( 65+x ,148+y ,5 , 7 ) ;
g.fillOval( 75+x ,145+y ,5 , 7 ) ;
g.fillOval( 85+x ,150+y ,5 , 7 ) ;
g.fillOval( 65+x ,160+y ,20 , 20 ) ;
g.setColor(new Color(80,180,80)) ; //右爪
g.fillOval( 200+x ,140+y ,50 , 70 ) ;
g.setColor(new Color(250,100,150)) ; //右指頭
g.fillOval( 210+x ,150+y ,5 , 7 ) ;
g.fillOval( 220+x ,145+y ,5 , 7 ) ;
g.fillOval( 230+x ,148+y ,5 , 7 ) ;
g.fillOval( 240+x ,155+y ,5 , 7 ) ;
g.fillOval( 215+x ,160+y ,20 , 20 ) ;
g.setColor(new Color(80,180,80)) ; //左后爪
g.fillOval( 50+x ,280+y ,50 , 70 ) ;
g.setColor(new Color(250,100,150)) ; //左后指頭
g.fillOval( 50+x ,315+y ,5 , 7 ) ;
g.fillOval( 55+x ,328+y,5 , 7 ) ;
g.fillOval( 65+x ,340+y ,5 , 7 ) ;
g.fillOval( 80+x ,340+y ,5 , 7 ) ;
g.fillOval( 63+x ,310+y ,20 , 20 ) ;
g.setColor(new Color(80,180,80)) ; //右后爪
g.fillOval( 200+x ,280+y ,50 , 70 ) ;
g.setColor(new Color(250,100,150)) ; //右后指頭
g.fillOval( 245+x ,320+y ,5 , 7 ) ;
g.fillOval( 240+x ,330+y ,5 , 7 ) ;
g.fillOval( 230+x ,340+y ,5 , 7 ) ;
g.fillOval( 215+x ,338+y ,5 , 7 ) ;
g.fillOval( 215+x ,310+y ,20 , 20 ) ;
}
if (b){
g.setColor(new Color(50 ,160 , 50)) ; //大圈
g.fillOval( 60+x , 150+y , 180 ,200 ) ;
g.setColor(new Color(50,200,50)) ;
g.fillOval( 70+x , 160+y , 160 ,180 ) ; //小圈
g.setColor(new Color(0,0,0)) ;
g.drawLine( 130+x , 210+y , 170+x , 210+y ) ; //中間的花紋
g.drawLine( 170+x , 210+y , 200+x , 240+y ) ;
g.drawLine( 200+x , 240+y , 170+x , 270+y ) ;
g.drawLine( 170+x , 270+y , 130+x , 270+y ) ;
g.drawLine( 130+x , 270+y , 100+x , 240+y ) ;
g.drawLine( 100+x , 240+y , 130+x , 210+y ) ;??
g.drawLine( 100+x , 180+y , 130+x , 210+y ) ; //擴(kuò)散出來(lái)的花紋
g.drawLine( 170+x , 210+y , 200+x ,180+y ) ;
g.drawLine( 200+x , 240+y , 230+x ,250+y ) ;
g.drawLine( 170+x , 270+y , 200+x ,320+y ) ;
g.drawLine( 130+x , 270+y , 100+x ,320+y ) ;
g.drawLine( 100+x , 240+y , 70+x ,250+y ) ;
} else {
g.setColor(new Color(80,180,80)) ;
g.fillOval( 60+x , 150+y , 180 ,200 ) ; //大圈
g.setColor(new Color(255,230,240)) ;
g.fillOval( 70+x , 160+y , 160 ,180 ) ; //小圈
g.setColor(new Color(0,0,0)) ; //肚肚上的花紋
g.drawLine( 100+x ,180+y , 115+x , 195+y ) ;
g.drawLine( 200+x ,180+y , 185+x , 195+y ) ;
g.drawLine( 115+x ,195+y , 185+x , 195+y ) ;
g.drawLine( 100+x ,240+y , 75+x , 220+y ) ;
g.drawLine( 200+x ,240+y , 225+x , 220+y ) ;
g.drawLine( 100+x ,240+y , 200+x , 240+y ) ;
g.drawLine( 120+x ,290+y , 90+x , 310+y ) ;
g.drawLine( 180+x ,290+y , 210+x , 310+y ) ;
g.drawLine( 120+x ,290+y , 180+x , 290+y ) ;
g.drawLine( 150+x ,160+y , 150+x , 340+y ) ;
}
}
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
int x1,y1;
x1=e.getX();
y1=e.getY();
if(x1x){flag=1;}
if(x1x){flag=3;}
}
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
b=false;
repaint();
}
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
b=true;
repaint();
}
public void mouseDragged(MouseEvent arg0) {
// TODO Auto-generated method stub
b=true;
//???System.out.println("鼠標(biāo)拖動(dòng)");
//???System.out.println("X坐標(biāo):"+arg0.getX()+" Y坐標(biāo):"+arg0.getY());
x=arg0.getX();//獲得矩形右下角的X坐標(biāo)
y=arg0.getY();//獲得矩形右下角的Y坐標(biāo)
repaint();
}
public void mouseMoved(MouseEvent arg0) {
// TODO Auto-generated method stub
}
public void run() {
// TODO Auto-generated method stub
if(flag==1){
x++;
}
if(flag==2){
y++;
}
if(flag==3){
x--;
}
if(flag==4){
y--;
}
}
}
點(diǎn)擊烏龜,可以翻身。
JS實(shí)現(xiàn)的前端源碼 帶展示頁(yè) 完整代碼? 櫻花飄落?希望你會(huì)喜歡!
名稱(chēng)欄目:java櫻花源代碼,櫻花html代碼
鏈接分享:http://chinadenli.net/article36/dsiijpg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、企業(yè)建站、外貿(mào)建站、標(biāo)簽優(yōu)化、品牌網(wǎng)站制作、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)