Страницы

воскресенье, 17 августа 2014 г.

Проба, движение фото сверху в низ и обатно

<iframe width="560" height="315" src="https://www.youtube.com/embed/Jegj2D60zH8?si=Nn-cpNeZDfK8ePOF&amp;clip=UgkxEPWw9zLdbha2dD_7MdsxsEoaTVpcU4f3&amp;clipt=EKCzIxiAiCc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
..........................
https://youtube.com/clip/UgkxEPWw9zLdbha2dD_7MdsxsEoaTVpcU4f3?si=Nn-cpNeZDfK8ePOF
.................

<iframe width="560" height="315" src="https://www.youtube.com/embed/Jegj2D60zH8?si=Nn-cpNeZDfK8ePOF&amp;clip=UgkxEPWw9zLdbha2dD_7MdsxsEoaTVpcU4f3&amp;clipt=EKCzIxiAiCc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>


.............................................

import pygame
from pygame.locals import *

RED = (255, 0, 0)
GRAY = (150, 150, 150)

pygame.init()
w, h = 640, 440
screen = pygame.display.set_mode((w, h))
running = True

img = pygame.image.load('bird.png')
img.convert()
rect = img.get_rect()
rect.center = w // 2, h
moving = True

while running:
    for event in pygame.event.get():
        if event.type == QUIT:
            running = False

        elif event.type == MOUSEMOTION and rect.collidepoint(event.pos) and moving:
            rect.move_ip(0, -5)
            moving = False

        elif event.type == MOUSEMOTION and not rect.collidepoint(event.pos) and not moving:
            rect.move_ip(0, +5)
            moving = True

    screen.fill(GRAY)
    screen.blit(img, rect)
    pygame.draw.rect(screen, RED, rect, 1)
    pygame.display.update()

pygame.quit()
...................................

Комментариев нет:

Отправить комментарий