Sha256: dbc480f0022712195e358e0f4199f329a7e040aed7cebac6612020dd5b30397d
Contents?: true
Size: 547 Bytes
Versions: 2
Compression:
Stored size: 547 Bytes
Contents
module Browser; class Canvas class Gradient include Native attr_reader :context def initialize(context, *args, &block) @context = context super(case args.length when 4 then `#{@context.to_n}.createLinearGradient.apply(self, args)` when 6 then `#{@context.to_n}.createRadialGradient.apply(self, args)` else raise ArgumentError, "don't know where to dispatch" end) instance_eval(&block) end def add(position, color) `#{@context.to_n}.addColorStop(position, color)` self end end end; end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
diamonds-0.1.5 | lib/diamonds/opal/browser/canvas/gradient.rb |
opal-browser-0.2.0 | opal/browser/canvas/gradient.rb |