Class: Synthpunks::Image

Inherits:
Pixelart::Image
  • Object
show all
Defined in:
lib/synthpunks/image.rb

Class Method Summary collapse

Class Method Details

.generate(addr) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/synthpunks/image.rb', line 6

def self.generate( addr )
  puts "==> generate SyntheticPunk for #{addr}..."
   token_id = Synthpunks.getTokenID( addr )
   ## note: MUST sort for correct rendering order
   puts "    using (derived) token_id >#{token_id}<"
   attributes = Synthpunks.getAttributes( token_id ).sort
   puts "    using (pseudo-random derived) attributes >#{attributes}<:"
   attributes.each do |attribute|
       puts "       #{attribute} => #{SPRITESHEET_ATTRIBUTES[attribute]}"
   end

   img = new( 24, 24 )
   attributes.each do |attribute|
      img.compose!( SPRITESHEET[ attribute ] )
   end
   img
end