Class: Sunniesnow::Charter::TimeDependent
- Inherits:
-
Object
- Object
- Sunniesnow::Charter::TimeDependent
show all
- Includes:
- BeatSeries
- Defined in:
- lib/sscharter/charter/event.rb
Defined Under Namespace
Classes: DataPoint, InterpolablePiecewiseData, PiecewiseData, UninterpolablePiecewiseData
Constant Summary
collapse
- INTERPOLABLE =
%i[
x y opacity size scale_x scale_y skew_x skew_y rotation text tint_red tint_green tint_blue
circle_opacity circle_scale_x circle_scale_y circle_skew_x circle_skew_y circle_rotation
circle_tint_red circle_tint_green circle_tint_blue
width height anchor_x anchor_y
].freeze
- INTERPOLABLE_SET =
INTERPOLABLE.to_set.freeze
- UNINTERPOLABLE =
%i[z blend_mode circle_blend_mode text].freeze
- UNINTERPOLABLE_SET =
UNINTERPOLABLE.to_set.freeze
- BLEND_MODES =
%i[
normal add multiply screen darken lighten erase color_dodge color_burn linear_burn linear_dodge
linear_light hard_light soft_light pin_light difference exclusion overlay saturation color luminosity
normal_npm add_npm screen_npm none subtract divide vivid_light hard_mix negation min max
].freeze
- BLEND_MODES_SET =
BLEND_MODES.to_set
- UNINTERPOLABLE_TYPES =
{
blend_mode: BLEND_MODES_SET,
circle_blend_mode: BLEND_MODES_SET,
text: String
}.tap { _1.default = Numeric }.freeze
Instance Attribute Summary collapse
Attributes included from BeatSeries
#bpm_changes, #current_beat
-
#anchor_x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#anchor_y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#blend_mode(data_value = nil, value: nil, v: nil) ⇒ DataPoint, BLEND_MODES_SET
-
#circle_blend_mode(data_value = nil, value: nil, v: nil) ⇒ DataPoint, BLEND_MODES_SET
-
#circle_opacity(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_rotation(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_scale_x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_scale_y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_skew_x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_skew_y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_tint_blue(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_tint_green(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#circle_tint_red(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#height(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#opacity(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#rotation(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#scale_x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#scale_y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#size(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#skew_x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#skew_y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#text(data_value = nil, value: nil, v: nil) ⇒ DataPoint, String
-
#tint_blue(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#tint_green(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#tint_red(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#width(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#x(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#y(data_value = nil, speed: nil, s: nil) ⇒ DataPoint, Float
-
#z(data_value = nil, value: nil, v: nil) ⇒ DataPoint, Numeric
Methods included from BeatSeries
#beat, #beat!, #bpm
Instance Method Summary
collapse
Methods included from BeatSeries
#current_beat_state, #restore_beat_state, #time_at
Constructor Details
#initialize(beat, bpm_changes) ⇒ TimeDependent
Returns a new instance of TimeDependent.
Instance Attribute Details
213
214
215
|
# File 'lib/sscharter/charter/event.rb', line 213
def data
@data
end
|
Instance Method Details
225
226
227
|
# File 'lib/sscharter/charter/event.rb', line 225
def [] key
@data.has_key?(key) ? @data[key] : nil
end
|
#anchor_x(data_value) ⇒ DataPoint
#anchor_x(speed:) ⇒ Float
#anchor_x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#anchor_y(data_value) ⇒ DataPoint
#anchor_y(speed:) ⇒ Float
#anchor_y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/sscharter/charter/event.rb', line 331
UNINTERPOLABLE.each do |property|
define_method property do |data_value = nil, value: nil, v: nil|
raise ArgumentError, "cannot specify both value and v" if !value.nil? && !v.nil?
value = v if value.nil?
raise ArgumentError, "must specify one and only one of data_value and value" if [data_value, value].compact.size != 1
if !data_value.nil?
raise ArgumentError, "wrong data type for data_value of #{property}" unless UNINTERPOLABLE_TYPES[property] === data_value
@data[property].data_point @current_beat, data_value
else
raise ArgumentError, "wrong data type for value of #{property}" unless UNINTERPOLABLE_TYPES[property] === value
@data[property].value = value
end
end
end
|
#circle_blend_mode(data_value) ⇒ DataPoint
#circle_blend_mode(value:) ⇒ BLEND_MODES_SET
#circle_blend_mode(v:) ⇒ BLEND_MODES_SET
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/sscharter/charter/event.rb', line 331
UNINTERPOLABLE.each do |property|
define_method property do |data_value = nil, value: nil, v: nil|
raise ArgumentError, "cannot specify both value and v" if !value.nil? && !v.nil?
value = v if value.nil?
raise ArgumentError, "must specify one and only one of data_value and value" if [data_value, value].compact.size != 1
if !data_value.nil?
raise ArgumentError, "wrong data type for data_value of #{property}" unless UNINTERPOLABLE_TYPES[property] === data_value
@data[property].data_point @current_beat, data_value
else
raise ArgumentError, "wrong data type for value of #{property}" unless UNINTERPOLABLE_TYPES[property] === value
@data[property].value = value
end
end
end
|
#circle_opacity(data_value) ⇒ DataPoint
#circle_opacity(speed:) ⇒ Float
#circle_opacity(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_rotation(data_value) ⇒ DataPoint
#circle_rotation(speed:) ⇒ Float
#circle_rotation(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_scale_x(data_value) ⇒ DataPoint
#circle_scale_x(speed:) ⇒ Float
#circle_scale_x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_scale_y(data_value) ⇒ DataPoint
#circle_scale_y(speed:) ⇒ Float
#circle_scale_y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_skew_x(data_value) ⇒ DataPoint
#circle_skew_x(speed:) ⇒ Float
#circle_skew_x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_skew_y(data_value) ⇒ DataPoint
#circle_skew_y(speed:) ⇒ Float
#circle_skew_y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_tint_blue(data_value) ⇒ DataPoint
#circle_tint_blue(speed:) ⇒ Float
#circle_tint_blue(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_tint_green(data_value) ⇒ DataPoint
#circle_tint_green(speed:) ⇒ Float
#circle_tint_green(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#circle_tint_red(data_value) ⇒ DataPoint
#circle_tint_red(speed:) ⇒ Float
#circle_tint_red(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
TODO: use initialize_copy.
355
356
357
358
359
360
|
# File 'lib/sscharter/charter/event.rb', line 355
def dup
result = super
result.data = @data.transform_values { _1.dup }
result.data.default_proc = @data.default_proc
result
end
|
#empty? ⇒ Boolean
349
350
351
|
# File 'lib/sscharter/charter/event.rb', line 349
def empty?
@data.empty?
end
|
#height(data_value) ⇒ DataPoint
#height(speed:) ⇒ Float
#height(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#opacity(data_value) ⇒ DataPoint
#opacity(speed:) ⇒ Float
#opacity(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#rotation(data_value) ⇒ DataPoint
#rotation(speed:) ⇒ Float
#rotation(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#scale_x(data_value) ⇒ DataPoint
#scale_x(speed:) ⇒ Float
#scale_x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#scale_y(data_value) ⇒ DataPoint
#scale_y(speed:) ⇒ Float
#scale_y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#size(data_value) ⇒ DataPoint
#size(speed:) ⇒ Float
#size(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#skew_x(data_value) ⇒ DataPoint
#skew_x(speed:) ⇒ Float
#skew_x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#skew_y(data_value) ⇒ DataPoint
#skew_y(speed:) ⇒ Float
#skew_y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#text(data_value) ⇒ DataPoint
#text(value:) ⇒ String
#text(v:) ⇒ String
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#tint_blue(data_value) ⇒ DataPoint
#tint_blue(speed:) ⇒ Float
#tint_blue(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#tint_green(data_value) ⇒ DataPoint
#tint_green(speed:) ⇒ Float
#tint_green(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#tint_red(data_value) ⇒ DataPoint
#tint_red(speed:) ⇒ Float
#tint_red(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#to_sunniesnow ⇒ Hash
363
364
365
366
367
368
369
370
371
372
|
# File 'lib/sscharter/charter/event.rb', line 363
def to_sunniesnow
result = @data.transform_keys &:snake_to_camel
result.transform_values! &:to_sunniesnow
%i[blendMode circleBlendMode].each do |key|
next unless result.has_key? key
result[key][:dataPoints]&.each { _1[:value] = _1[:value].to_s.tr ?_, ?- }
result[key][:value] = result[key][:value].to_s.tr ?_, ?- if result[key][:value]
end
result
end
|
#width(data_value) ⇒ DataPoint
#width(speed:) ⇒ Float
#width(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#x(data_value) ⇒ DataPoint
#x(speed:) ⇒ Float
#x(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#y(data_value) ⇒ DataPoint
#y(speed:) ⇒ Float
#y(s:) ⇒ Float
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
# File 'lib/sscharter/charter/event.rb', line 298
INTERPOLABLE.each do |property|
define_method property do |data_value = nil, speed: nil, s: nil|
raise ArgumentError, 'cannot specify both speed and s' if !speed.nil? && !s.nil?
speed = s if speed.nil?
raise ArgumentError, 'must specify one and only one of data_value and speed' if [data_value, speed].compact.size != 1
if !data_value.nil?
raise ArgumentError, "#{property} must be a number" unless data_value.is_a? Numeric
@data[property].data_point @current_beat, data_value.to_f
else
raise ArgumentError, "speed must be a number" unless speed.is_a? Numeric
@data[property].speed = speed.to_f
end
end
end
|
#z(data_value) ⇒ DataPoint
#z(value:) ⇒ Numeric
#z(v:) ⇒ Numeric
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# File 'lib/sscharter/charter/event.rb', line 331
UNINTERPOLABLE.each do |property|
define_method property do |data_value = nil, value: nil, v: nil|
raise ArgumentError, "cannot specify both value and v" if !value.nil? && !v.nil?
value = v if value.nil?
raise ArgumentError, "must specify one and only one of data_value and value" if [data_value, value].compact.size != 1
if !data_value.nil?
raise ArgumentError, "wrong data type for data_value of #{property}" unless UNINTERPOLABLE_TYPES[property] === data_value
@data[property].data_point @current_beat, data_value
else
raise ArgumentError, "wrong data type for value of #{property}" unless UNINTERPOLABLE_TYPES[property] === value
@data[property].value = value
end
end
end
|