Sha256: 26247bc28907ae396f4e2a7ebdddd24726ec7a3fb5c0c8463845d2e1038cec11

Contents?: true

Size: 575 Bytes

Versions: 21

Compression:

Stored size: 575 Bytes

Contents

# @requires MotionKit::UIViewHelpers
module MotionKit
  class UIViewHelpers

    # 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

21 entries across 15 versions & 1 rubygems

Version Path
motion-kit-1.1.1 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.1.1 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-1.1.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-1.1.0 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.3 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.3 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.2 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.2 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.1 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.1 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.0 lib/motion-kit-tvos/helpers/uiview_gradient_helpers.rb
motion-kit-1.0.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.18.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.17.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.16.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.15.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.14.2 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.14.1 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.14.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb
motion-kit-0.13.0 lib/motion-kit-ios/helpers/uiview_gradient_helpers.rb