最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

強(qiáng)迫癥必看!兩點(diǎn)轉(zhuǎn)圓

2023-03-02 22:19 作者:Ioencgc  | 我要投稿
代碼:# -*- coding:utf-8 -*-
# 導(dǎo)入庫(kù)
import pygame
from pygame.locals import *
from math import sin, cos, pi
from os import environ
from random import randint

environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (460, 30)
# 初始化
pygame.init()
pygame.font.init()

canvas = pygame.display.set_mode((1000, 1000))  # 創(chuàng)建窗口
pygame.display.set_caption("circle")  # 明明窗口標(biāo)題
canvas.fill((255, 255, 255))
pygame.font.init()


class Point:
    def __init__(self):
        self.r = 300
        self.aRect = Rect(500, 200, 0, 0)
        self.bRect = Rect(500, 200, 0, 0)
        self.aA = 0
        self.bA = 0
        self.lines = [[500, 800]]
        # self.lines2 = [[500, 800]]
        self.font = pygame.font.SysFont('Segoe Print', 16)

    def move(self):
        self.aRect.x, self.aRect.y = 500 + 300 * sin(self.aA * pi / 180), 500 + 300 * cos(self.aA * pi / 180)
        self.bRect.x, self.bRect.y = 500 + 300 * sin(self.bA * pi / 180), 500 + 300 * cos(self.bA * pi / 180)
        self.lines.append([self.aRect.x, self.bRect.y])
        # self.lines2.append([self.bRect.x, self.aRect.y])
        self.aA += 1.1
        self.bA -= 1.3

    def draw(self):
        canvas.fill((255, 255, 255))
        pygame.draw.circle(canvas, [0, 200, 0], [500, 500], 300, 1)
        pygame.draw.aalines(canvas, [0, 0, 0], False, self.lines, 1)
        # pygame.draw.aalines(canvas, [0, 0, 0], False, self.lines2, 1)

        pygame.draw.circle(canvas, [0, 0, 255], [self.aRect.x, self.aRect.y], 4, 4)
        pygame.draw.line(canvas, [200, 200, 200], [self.aRect.x, 0], [self.aRect.x, 1000], 1)
        # pygame.draw.line(canvas, [200, 200, 200], [0, self.aRect.y], [1000, self.aRect.y], 1)

        pygame.draw.circle(canvas, [0, 0, 255], [self.bRect.x, self.bRect.y], 4, 4)
        pygame.draw.line(canvas, [200, 200, 200], [0, self.bRect.y], [1000, self.bRect.y], 1)
        # pygame.draw.line(canvas, [200, 200, 200], [self.bRect.x, 0], [self.bRect.x, 1000], 1)

        pygame.draw.circle(canvas, [255, 0, 0], [self.aRect.x, self.bRect.y], 4, 4)
        # pygame.draw.circle(canvas, [255, 0, 0], [self.bRect.x, self.aRect.y], 4, 4)

        # canvas.blit(self.font.render(
        #     'x: {}, y: {}'.format(self.aRect.x, self.bRect.y), True,
        #     (0, 0, 0), (255, 255, 255)), (self.aRect.x, self.bRect.y))

        pygame.display.update()


def handleEvent():  # 創(chuàng)建按鍵檢測(cè)方法
    for event in pygame.event.get():
        # 按下關(guān)閉鍵或ESC鍵時(shí)關(guān)閉程序
        if event.type == QUIT or event.type == KEYDOWN and event.key == K_ESCAPE:
            pygame.quit()
            exit()


point = Point()
while True:
    point.move()
    point.draw()
    handleEvent()
    pygame.time.delay(10)


強(qiáng)迫癥必看!兩點(diǎn)轉(zhuǎn)圓的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
海口市| 兰州市| 明光市| 龙游县| 平昌县| 黔东| 阿拉善盟| 广东省| 丹寨县| 汶川县| 唐海县| 闽侯县| 桂林市| 海丰县| 南雄市| 潜江市| 揭东县| 鄄城县| 德格县| 红河县| 平塘县| 屏山县| 兴义市| 桂阳县| 临颍县| 六安市| 方山县| 凤山市| 安顺市| 电白县| 罗源县| 南通市| 长阳| 江北区| 贺州市| 大余县| 阿尔山市| 新巴尔虎右旗| 济阳县| 屏边| 广东省|