An open API service indexing awesome lists of open source software.

https://github.com/maximbilan/sktexturegradient

A SpriteKit SKTexture Gradient
https://github.com/maximbilan/sktexturegradient

gradient ios spritekit swift texture

Last synced: 2 months ago
JSON representation

A SpriteKit SKTexture Gradient

Awesome Lists containing this project

README

        

# SKTextureGradient

[![Version](https://img.shields.io/cocoapods/v/SKTextureGradient.svg?style=flat)](http://cocoadocs.org/docsets/SKTextureGradient)
[![License](https://img.shields.io/cocoapods/l/SKTextureGradient.svg?style=flat)](http://cocoadocs.org/docsets/SKTextureGradient)
[![Platform](https://img.shields.io/cocoapods/p/SKTextureGradient.svg?style=flat)](http://cocoadocs.org/docsets/SKTextureGradient)
[![CocoaPods](https://img.shields.io/cocoapods/dt/SKTextureGradient.svg)](https://cocoapods.org/pods/SKTextureGradient)
[![CocoaPods](https://img.shields.io/cocoapods/dm/SKTextureGradient.svg)](https://cocoapods.org/pods/SKTextureGradient)

A simple SKTexture extension for creating a gradient effect in SpriteKit.

# Installation

CocoaPods:


pod 'SKTextureGradient'

Manual:


Copy SKTextureGradient.swift to your project.

# Using


let topColor = CIColor(rgba: "#71B280")
let bottomColor = CIColor(rgba: "#134E5E")

let texture = SKTexture(size: CGSizeMake(200, 200), color1: topColor, color2: bottomColor, direction: GradientDirection.up)
texture.filteringMode = .Nearest

let sprite = SKSpriteNode(texture: texture)
sprite.position = CGPointMake(CGRectGetMidX(frame), CGRectGetMidY(frame))
sprite.size = self.frame.size
addChild(sprite)

# Example

![alt tag](https://raw.github.com/maximbilan/SKTextureGradient/master/example.png)

## License

SKTextureGradient is available under the MIT license. See the LICENSE file for more info.