Class: Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient

### Home Classes Methods

### In Files

- lib/compass/core/sass_extensions/functions/gradient_support.rb

### Parent

Sass::Script::Value::Base

### Methods

- ::new
- #array_to_s
- #children
- #new_standard_arguments
- #old_standard_arguments
- #supports?
- #to_css2
- #to_moz
- #to_official
- #to_s
- #to_s_prefixed
- #to_svg
- #to_webkit

### Included Modules

- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient
- Compass::Core::SassExtensions::Functions::GradientSupport::Assertions
- Compass::Core::SassExtensions::Functions::GradientSupport::Functions
- Compass::Core::SassExtensions::Functions::Constants
- Compass::Core::SassExtensions::Functions::InlineImage

### Class/Module Index

Quicksearch

- Compass
- Compass::BrowserSupport
- Compass::Configuration
- Compass::Configuration::Adapters
- Compass::Configuration::Data
- Compass::Configuration::Defaults
- Compass::Configuration::Inheritance
- Compass::Configuration::Inheritance::ClassMethods
- Compass::Configuration::Inheritance::ClassMethods::ArrayProxy
- Compass::Configuration::Inheritance::InstanceMethods
- Compass::Configuration::Paths
- Compass::Configuration::Watch
- Compass::Core
- Compass::Core::CanIUse
- Compass::Core::SassExtensions
- Compass::Core::SassExtensions::Functions
- Compass::Core::SassExtensions::Functions::Colors
- Compass::Core::SassExtensions::Functions::Configuration
- Compass::Core::SassExtensions::Functions::Constants
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport
- Compass::Core::SassExtensions::Functions::CrossBrowserSupport::CSS2FallbackValue
- Compass::Core::SassExtensions::Functions::Display
- Compass::Core::SassExtensions::Functions::Enumerate
- Compass::Core::SassExtensions::Functions::Env
- Compass::Core::SassExtensions::Functions::Files
- Compass::Core::SassExtensions::Functions::FontFiles
- Compass::Core::SassExtensions::Functions::GradientSupport
- Compass::Core::SassExtensions::Functions::GradientSupport::Assertions
- Compass::Core::SassExtensions::Functions::GradientSupport::CSS3AngleToSVGConverter
- Compass::Core::SassExtensions::Functions::GradientSupport::ColorStop
- Compass::Core::SassExtensions::Functions::GradientSupport::Functions
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient
- Compass::Core::SassExtensions::Functions::GradientSupport::Gradient::ClassMethods
- Compass::Core::SassExtensions::Functions::GradientSupport::LinearGradient
- Compass::Core::SassExtensions::Functions::GradientSupport::RadialGradient
- Compass::Core::SassExtensions::Functions::ImageSize
- Compass::Core::SassExtensions::Functions::ImageSize::ImageProperties
- Compass::Core::SassExtensions::Functions::ImageSize::JPEG
- Compass::Core::SassExtensions::Functions::InlineImage
- Compass::Core::SassExtensions::Functions::Lists
- Compass::Core::SassExtensions::Functions::Math
- Compass::Core::SassExtensions::Functions::SassDeclarationHelper
- Compass::Core::SassExtensions::Functions::Selectors
- Compass::Core::SassExtensions::Functions::Urls
- Compass::Core::SassExtensions::Functions::Urls::FontUrl
- Compass::Core::SassExtensions::Functions::Urls::GeneratedImageUrl
- Compass::Core::SassExtensions::Functions::Urls::ImageUrl
- Compass::Core::SassExtensions::Functions::Urls::StylesheetUrl
- Compass::Error
- Compass::Frameworks
- Compass::Frameworks::Framework
- Compass::HasDeprecatedConstantsFromCore
- Compass::SassExtensions
- Compass::SassExtensions::Functions
- Compass::Util
- Sass
- Sass::Script
- Sass::Script::CrossBrowserFunctionCall
- Sass::Script::Funcall
- Sass::Script::Functions
- Sass::Script::Functions::EvaluationContext
- Sass::Script::HasSimpleCrossBrowserFunctionSupport
- Sass::Script::List
- Sass::Script::Value
- Sass::Script::Value::ArgList
- Sass::Script::Value::Base
- Sass::Script::Value::List
- Sass::Script::Value::Map
- Sass::Tree
- Sass::Tree::Node

No matching classes.

# Compass::Core::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/core/sass_extensions/functions/gradient_support.rb, line 280
    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

array_to_s(array, opts) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 362
    def array_to_s(array, opts)
      if array.is_a?(Sass::Script::Value::List)
        array.to_s
      else
        l = list(array, :space)
        l.options = opts
        l.to_s
      end
    end

children() click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 276
    def children
      [color_stops, position, shape_and_size].compact
    end

new_standard_arguments(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 333
    def new_standard_arguments(options = self.options)
      if shape_and_size
        "#{array_to_s(shape_and_size, options)} at #{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
      elsif position
        "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
      else
        array_to_s(color_stops, options)
      end
    end

old_standard_arguments(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 343
    def old_standard_arguments(options = self.options)
      if shape_and_size
        "#{array_to_s(position, options)}, #{array_to_s(shape_and_size, options)}, #{array_to_s(color_stops, options)}"
      elsif position
        "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
      else
        array_to_s(color_stops, options)
      end
    end

supports?(aspect) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 300
    def supports?(aspect)
      # I don't know how to support radial old webkit gradients (owg)
      if %(owg).include?(aspect)
        false
      else
        super
      end
    end

to_css2(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 358
    def to_css2(options = self.options)
      null
    end

to_moz(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 319
    def to_moz(options = self.options)
      s = "-moz-radial-gradient("
      s << old_standard_arguments(options)
      s << ")"
      identifier(s)
    end

to_official() click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 326
    def to_official
      s = "radial-gradient("
      s << new_standard_arguments(options)
      s << ")"
      identifier(s)
    end

to_s(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 292
    def to_s(options = self.options)
      to_official.to_s
    end

to_s_prefixed(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 296
    def to_s_prefixed(options = self.options)
      to_s(options)
    end

to_svg(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 353
    def to_svg(options = self.options)
      # XXX Add shape support if possible
      radial_svg_gradient(color_stops, position || _center_position)
    end

to_webkit(options = self.options) click to toggle source

    # File lib/compass/core/sass_extensions/functions/gradient_support.rb, line 312
    def to_webkit(options = self.options)
      s = "-webkit-radial-gradient("
      s << old_standard_arguments(options)
      s << ")"
      identifier(s)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.