Skip to content

Processing 3 code to play Bad Apple !! with moon phase emojis.

License

Notifications You must be signed in to change notification settings

pavlus/bad_apple_moon_emoji

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

maxresdefault

Bad Apple: Moon Phase Emoji edition

Once I’ve opened Telegram and seen this:

🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕
🌕🌕🌘🌑🌓🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕
🌕🌕🌑🌕🌕🌕🌗🌑🌑🌑🌕🌕🌕🌕🌕
🌕🌕🌑🌕🌕🌖🌑👁🌑👁🌔🌗🌑🌕🌕
🌕🌕🌘🌓🌕🌑🌑🌑🌑🌑🌔🌕🌘🌔🌕
🌕🌕🌗🌑🌘🌑🌑🌑🌑🌑🌕🌖🌑🌕🌕
🌕🌕🌕🌘🌑🌑🌑🌑🌑🌕🌖🌑🌔🌕🌕
🌕🌕🌕🌖🌑🌑🌑🌑🌑🌑🌑🌔🌕🌕🌕
🌕🌕🌕🌗🌑🌑🌑🌑🌑🌑🌕🌕🌕🌕🌕
🌕🌕🌕🌘🌑🌕🌕🌘🌑🌔🌕🌕🌕🌕🌕
🌕🌕🌕🌑🌓🌕🌕🌗🌑🌕🌕🌕🌕🌕🌕
🌕🌕🌖🌑🌔🌕🌕🌖🌑🌔🌕🌕🌕🌕🌕
🌕🌕🌗🌑🌕🌕🌕🌕🌑🌑🌕🌕🌕🌕🌕
🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕🌕

(thank you, @folex)

And that’s how idea was born.

Installation

  1. Install Processing 3

  2. Open the bad_apple_emoji.pde file in Processing 3 and press button (or Ctrl+R)

  3. Change it! You can play around with output size, tile size, select one of two available emoji themes, or get creative and write some more code!

How it works

  1. Split frame into tiles. Each tile will have a single emoji.

  2. For each tile:

    1. Split tiles horizontally into 4 vertical regions.

    2. Average each region color, calculate it’s brightness, and check if it crosses threshold.

    3. Calculate perceptual hash of the tile: set corresponding to the region bits in range 0:3 to 1 if the region is brighter than the defined threshold and 0 if it’s darker.

    4. Lookup image from table that matches such hash (table constructed manually, with approximations)

    5. Draw corresponding image at the current tile.

About

Processing 3 code to play Bad Apple !! with moon phase emojis.

Topics

Resources

License

Stars

Watchers

Forks