Module: Lotu::InterpolationSystem::UserMethods

Defined in:
lib/lotu/systems/interpolation_system.rb

Instance Method Summary collapse

Instance Method Details

#interpolate(object, property, opts) ⇒ Object



97
98
99
# File 'lib/lotu/systems/interpolation_system.rb', line 97

def interpolate(object, property, opts)
  @systems[InterpolationSystem].interpolate(object, property, opts)
end

#interpolate_alpha(opts) ⇒ Object

Color helpers



119
120
121
# File 'lib/lotu/systems/interpolation_system.rb', line 119

def interpolate_alpha(opts)
  interpolate(@color, :alpha, opts.merge!(:every_value => :to_i))
end

#interpolate_angle(opts) ⇒ Object

Image helpers



106
107
108
# File 'lib/lotu/systems/interpolation_system.rb', line 106

def interpolate_angle(opts)
  interpolate(self, :angle, opts)
end

#interpolate_blue(opts) ⇒ Object



131
132
133
# File 'lib/lotu/systems/interpolation_system.rb', line 131

def interpolate_blue(opts)
  interpolate(@color, :blue, opts.merge!(:every_value => :to_i))
end

#interpolate_green(opts) ⇒ Object



127
128
129
# File 'lib/lotu/systems/interpolation_system.rb', line 127

def interpolate_green(opts)
  interpolate(@color, :green, opts.merge!(:every_value => :to_i))
end

#interpolate_height(opts) ⇒ Object



114
115
116
# File 'lib/lotu/systems/interpolation_system.rb', line 114

def interpolate_height(opts)
  interpolate(self, :height, opts)
end

#interpolate_hue(opts) ⇒ Object



135
136
137
# File 'lib/lotu/systems/interpolation_system.rb', line 135

def interpolate_hue(opts)
  interpolate(@color, :hue, opts)
end

#interpolate_my(property, opts) ⇒ Object



101
102
103
# File 'lib/lotu/systems/interpolation_system.rb', line 101

def interpolate_my(property, opts)
  interpolate(self, property, opts)
end

#interpolate_red(opts) ⇒ Object



123
124
125
# File 'lib/lotu/systems/interpolation_system.rb', line 123

def interpolate_red(opts)
  interpolate(@color, :red, opts.merge!(:every_value => :to_i))
end

#interpolate_saturation(opts) ⇒ Object



139
140
141
# File 'lib/lotu/systems/interpolation_system.rb', line 139

def interpolate_saturation(opts)
  interpolate(@color, :saturation, opts)
end

#interpolate_value(opts) ⇒ Object



143
144
145
# File 'lib/lotu/systems/interpolation_system.rb', line 143

def interpolate_value(opts)
  interpolate(@color, :value, opts)
end

#interpolate_width(opts) ⇒ Object



110
111
112
# File 'lib/lotu/systems/interpolation_system.rb', line 110

def interpolate_width(opts)
  interpolate(self, :width, opts)
end

#stop_interpolationsObject

Clear all interpolations on this object



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/lotu/systems/interpolation_system.rb', line 84

def stop_interpolations
  @systems[InterpolationSystem].interpolations.each do |t|
    if t[:on_stop] == :complete
      value = t[:end]
    else
      value = t[:init] + t[:calc]
    end
    value = value.send(t[:every_value]) if t[:every_value]
    t[:object].send( t[:property_setter], value )
  end
  @systems[InterpolationSystem].interpolations.clear
end