zoukankan      html  css  js  c++  java
  • Working with Other Node Types

    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

      

  • 相关阅读:
    redis分布式锁解决超卖问题
    redis使用
    Xcode 解决日志打印不全问题
    苹果电脑系统怎么重装?这几步就可以轻松搞定
    Mac 一键显示所有隐藏文件 不要那么六好吧
    iOS导入高德地图出现缺失armv7--"Undefined symbols for architecture armv7"
    如何生成.a文件,小心有坑!!
    保护你的代码,生成.a文件以及.framework文件需要注意的地方
    二维码扫描工具实现
    iOS 调整图片尺寸,告诉你的UI,别问我尺寸!我要最大的
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3530503.html
Copyright © 2011-2022 走看看