Skip to content

Instantly share code, notes, and snippets.

@veeneck
Created May 28, 2015 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save veeneck/e68c62e4417bfa03a62d to your computer and use it in GitHub Desktop.
Save veeneck/e68c62e4417bfa03a62d to your computer and use it in GitHub Desktop.
Using SKUniform
let sprite = self.childNodeWithName("targetSprite") as! SKSpriteNode
let shader = SKShader(fileNamed: "shader1.fsh")
shader.uniforms = [
SKUniform(name: "u_gradient", texture: SKTexture(imageNamed: "circleshader")),
SKUniform(name: "u_health", float: 0.75)
]
sprite.shader = shader
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment