首页 > 其他 > 详细

Working with Other Node Types

时间:2014-01-23 08:17:51      阅读:364      评论:0      收藏:0      [点我收藏+]

Working with Other Node Types

  bubuko.com,布布扣

Shape Nodes Draw Path-Based Shapes

  The SKShapeNode class draws a standard Core Graphics path. 

  bubuko.com,布布扣

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. 

 bubuko.com,布布扣

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 来添加内置模板到应用程序。

  bubuko.com,布布扣

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

  bubuko.com,布布扣

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

 bubuko.com,布布扣

  bubuko.com,布布扣 bubuko.com,布布扣

  Setting the Number of Particles Created

  bubuko.com,布布扣

  Setting a Particle’s Life Expectancy

  bubuko.com,布布扣

Working with Other Node Types

原文:http://www.cnblogs.com/tekkaman/p/3530503.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!