Introduction:
Perhaps for harmony, in the human world on the day of start of Winter 👇
Many cities in the north, quietly falling the first snow of winter, formed a melody 💨
After two seasons in a day, yellow leaves turn to fly flowers — falling from the sky, day and night, wake up one night, pavilion eaves dyed white, the Imperial Palace completed the transition from autumn to winter, stories from the north
Come through the snow 👼.
The palace walls are filled with a cloud of guests, while the traffic is busy outside. If you use the Forbidden City as a palace, you will feel cold all night long in winter.
Today directly to several groups about the Palace Museum, snow! Let’s give our southern friends a close look at the snow scenery of the Forbidden City ~ hope you like it!
The body of the
Have you been to the Forbidden City? If you have not been to the Palace Museum in Beijing, then follow the xiaobian together into the first snow
Whether you’ve ever seen snow, north or south, man or woman, we all seem to love it, mostly because in the long cold season
She is heaven’s surprise, like the stars in the dark sky, like the rainbow after a storm.
**👼 complete project package free waiting for you to take 👼 — 👼 xiaobian home page left source 👼 base see you! * * 👼
One, the Palace Museum snow: interface small procedures
1) Attached to the main program
Pygame pygame.init() SIZE = (850, Screen = Pygame.display.set_mode (SIZE) Pygame.display.set_mode (SIZE) Caption: bg = Pygame.image.load ('snow ') # list of snowflakes snow_list = [] # initialization snowflakes: [coordinates x, y coordinates, x axis speed, y axis speed] for I in range (200) : x = random.randrange(0, SIZE[0]) y = random.randrange(0, SIZE[1]) sx = random.randint(-1, 1) sy = random.randint(3, Snow_list.append ([x, y, sx, sy]) clock = pygame.time.clock () # game main loop done = False while not done: For event in Pygame.event.get (): if event.type == PyGame.quit: Done = True # screen.fill((0, 0, 0)) screen.blit(bg, (0, 0)) # snow_list loop for I in range(len(snow_list)): # Draw snowflakes, Pygame.draw. Circle (screen, (255, 255, 255), snow_list[I][:2], Snow_list [I][0] += snow_list[I][2] snow_list[I][1] += snow_list[I][3] # If snowflakes fall off the screen, If snow_list[I][1] > SIZE[1]: snow_list[i][1] = random.randrange(-50, -10) snow_list[i][0] = random.randrange(0, SIZE[0]) # Refresh screen pygame.display.flip() clock.tick(20)Copy the code
2) Effect display
Part 01 Show —
Part 02 Show —
Two, the Palace Museum snow: hand-drawn sketches
1) Main program
Root = tkinter. Tk (). The withdraw () filename = tkinter. Filedialog. Askopenfilename () # open select file dialog box to try: Depth = 30 # 0-100, the higher you go, The deeper the color picture_grad = np.gradient(np.asarray(image.open (filename).convert('L')).astype('int')) grad_y = picture_grad[0] * depth / 100., Base = np. SQRT (grad_x ** 2 + grad_y ** 2 + 1.) # noise base _x, _y, / base sce_z, sce_x = np.pi / 2.1, np.pi / 3 dy, dz = np.cos(sce_z) * np.cos(sce_x), np.cos(sce_z) * np.sin(sce_x), np.sin(sce_z) Normalized = 255 * (dx * _x + dy * _y + dz * _z).clip(0, JPG () # save(' uint8') # save im.show() # Except Exception: print(' Conversion failed! ')Copy the code
2) Effect display
Part 01 Show —
Part 02 Show —
conclusion
** A first snow, let the Forbidden City back into the Forbidden City! ** The Palace Museum of snow, no promises, as promised and to the red walls of glazed tiles, snow in the Palace Museum picturesque!
Words I also want to go to Beijing palace to see ~ real name envy acrid~~~~
Finally — don’t forget to pay attention to the three
See the complete project source code: click on the blue font or private small editor 06.
👑 Article summary —
Python 1.1-2021 | for the article summary | continuously updated, direct look at this article is enough ~