Sha256: 3cfb6fdc5fdd765f8ca070d6d8df0048fab5b0874c23450425162192dcb5e803

Contents?: true

Size: 573 Bytes

Versions: 18

Compression:

Stored size: 573 Bytes

Contents

# @requires MotionKit::UIViewLayout
module MotionKit
  class UIViewLayout

    # gradient colors:
    def gradient(&block)
      gradient_layer = target.motion_kit_meta[:motionkit_gradient_layer] || begin
        gradient_layer = CAGradientLayer.layer
        gradient_layer.frame = CGRect.new([0, 0], target.frame.size)
        target.layer.insertSublayer(gradient_layer, atIndex:0)
        target.motion_kit_meta[:motionkit_gradient_layer] = gradient_layer

        gradient_layer
      end

      context(gradient_layer, &block)

      gradient_layer
    end

  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
motion-kit-0.11.2 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.11.1 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.11.0 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.11 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.10 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.9 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.8 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.7 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.6 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.5 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.4 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.3 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.2 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.1 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.10.0 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.9.6 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.9.4 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb
motion-kit-0.9.3 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb