Class: Castaway::Element::Still

Inherits:
Base
  • Object
show all
Defined in:
lib/castaway/element/still.rb

Direct Known Subclasses

Pointer

Instance Attribute Summary collapse

Attributes inherited from Base

#attributes, #position, #production, #scene, #size

Instance Method Summary collapse

Methods inherited from Base

#_absolute, #_composite, #_convert, #_evaluate_animation_list, #_evaluate_attributes!, #_transform, #alive_at?, #animate, #at, #attribute, #duration, #effect, #enter, #exit, #gravity, #in, #out, #path, #render_at, #rotate, #scale, #t1, #t2, #tail

Constructor Details

#initialize(production, scene, filename, full: false) ⇒ Still

Returns a new instance of Still.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/castaway/element/still.rb', line 10

def initialize(production, scene, filename, full: false)
  super(production, scene)

  @filename = production.resource(filename)
  @info = MiniMagick::Image.new(@filename)

  @size = if full
            # scale to production resolution
            production.resolution
          else
            # use native image size
            Castaway::Size.new(@info.width, @info.height)
          end
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



8
9
10
# File 'lib/castaway/element/still.rb', line 8

def filename
  @filename
end

#infoObject (readonly)

Returns the value of attribute info.



8
9
10
# File 'lib/castaway/element/still.rb', line 8

def info
  @info
end

Instance Method Details

#_prepare_canvas(_t, canvas) ⇒ Object



25
26
27
# File 'lib/castaway/element/still.rb', line 25

def _prepare_canvas(_t, canvas)
  canvas << @filename
end