Working with Other Node Types

  

Shape Nodes Draw Path-Based Shapes

  The SKShapeNode class draws a standard Core Graphics path.

  

You can see from the code that the shape has three essential elements:

  • The interior of the shape is filled. The fillColor property specifies the color used to fill the interior.
  • The outline of the shape is rendered as a line. The strokeColor and lineWidth properties define how the line is stroked.
  • A glow extends from the outline. The glowWidth and strokeColor properties define the glow.

A Video Node Plays a Movie

  The SKVideoNode class uses the AV Foundation framework to display movie content.

 

Emitter Nodes Create Particle Effects

  When an SKEmitterNode object is placed in a scene, it automatically creates and renders new particles. You use emitter nodes to automatically create special effects, including rain, explosions, or fire.

A particle is similar to an SKSpriteNode object; it renders a textured or untextured image that is sized, colorized, and blended into the scene. However, particles differ from sprites in two important ways:

  • A particle’s texture is always stretched uniformly.
  • Particles are not represented by objects in Sprite Kit. This means you cannot perform node-related tasks on particles, nor can you associate physics bodies with particles to make them interact with other content.

Particles are purely visual objects, and their behavior is entirely defined by the emitter node that created them. The emitter node contains many properties to control the behavior of the particles it spawns, including:

  • The birth rate and lifetime the particle. You can also specify the maximum number of particles that are spawned before the emitter turns itself off.
  • The starting values of the particle, including its position, orientation, color, and size. These starting values are typically randomized.
  • The changes to apply to the particle over its lifetime. Typically, these are specified as a rate-of-change over time. For example, you might specify that a particle rotates at a particular rate, in radians per second. The emitter automatically updates the particle data each frame. In most cases, you can also create more sophisticated behaviors using keyframe sequences. For example, you might specify a keyframe sequence for a particle so that it starts out small, scales up to a larger size, then shrinks before dying.

Use the Particle Emitter Editor to Experiment with Emitters

  内置Particle模板,如下,通过File->Resource->SpriteKit Particle 来添加内置模板到应用程序。

  

  Inspector中可以修改Particle效果,立即生效。

  

  Particle Textrue用于修改粒子使用的texture,如下面两图使用了不同的ParticleTexture,

 

   

  Setting the Number of Particles Created

  

  Setting a Particle’s Life Expectancy

  

最新文章

  1. IIS7.0部署MVC/WebApi项目,报404.4错误
  2. NOI2018准备Day3
  3. phpcms更换域名用户无法注册问题
  4. angular.js input
  5. Slip.js – 在触摸屏上实现列表的滑动排序功能
  6. Fast and Robust Hand Tracking Using Detection-Guided Optimization
  7. DispatcherServlet
  8. 【JQuery基础教程(第三版)图灵】笔记
  9. libiconv2.dll
  10. iOS # Charles拦截封包
  11. vxworks for x86读取bios时间的解决方法
  12. nodejs调试总结
  13. 初识Java NIO
  14. 学习前端笔记1(HTML)
  15. JavaScript中变量、执行环境、作用域与C#中的异同
  16. 利用captcha库绘制验证码
  17. blender 操作快捷键
  18. 移动前端开发和 Web 前端开发的区别
  19. __init__和__new__,以及self
  20. veloctiy入门

热门文章

  1. Spring的注解方式
  2. iOS富文本(三)深入使用Text Kit
  3. JSP:include的flush属性的作用
  4. echarts地图点定位的问题
  5. mysql笔记(前面自己写的不标准有些地方)
  6. POJ 3692 Kindergarten (补图是二分图的最大团问题)
  7. 通过javascript把图片转化为字符画
  8. putty保持Session链接不断开的方法
  9. eclipse环境下tomcat远程调试方法
  10. Asp.net 身份验证方式?