class Compass::SassExtensions::Functions::GradientSupport::RadialGradient
Attributes
color_stops[RW]
position[RW]
shape_and_size[RW]
Public Class Methods
new(position, shape_and_size, color_stops)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 92 def initialize(position, shape_and_size, color_stops) unless color_stops.value.size >= 2 raise Sass::SyntaxError, "At least two color stops are required for a radial-gradient" end if angle?(position) raise Sass::SyntaxError, "CSS no longer allows angles in radial-gradients." end self.position = position self.shape_and_size = shape_and_size self.color_stops = color_stops end
Public Instance Methods
children()
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 88 def children [color_stops, position, shape_and_size].compact end
to_css2(options = self.options)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 138 def to_css2(options = self.options) Sass::Script::String.new("") end
to_owg(options = self.options)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 116 def to_owg(options = self.options) args = [ grad_point(position || _center_position), Sass::Script::String.new("0"), grad_point(position || _center_position), grad_end_position(color_stops, Sass::Script::Bool.new(true)), grad_color_stops(color_stops) ] args.each {|a| a.options = options} Sass::Script::String.new("-webkit-gradient(radial, #{args.join(', ')})") end
to_pie(options = self.options)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 133 def to_pie(options = self.options) Compass::Logger.new.record(:warning, "PIE does not support radial-gradient.") Sass::Script::String.new("-pie-radial-gradient(unsupported)") end
to_s(options = self.options)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 104 def to_s(options = self.options) s = "radial-gradient(" s << position.to_s(options) << ", " if position s << shape_and_size.to_s(options) << ", " if shape_and_size s << color_stops.to_s(options) s << ")" end
to_svg(options = self.options)
click to toggle source
# File lib/compass/sass_extensions/functions/gradient_support.rb, line 128 def to_svg(options = self.options) # XXX Add shape support if possible radial_svg_gradient(color_stops, position || _center_position) end