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

      

  • 相关阅读:
    Linux中几种常用的查看文件内容的命令(file,cat,more,less,head,tail)
    Linux 链接文件讲解
    postgreSQL psql工具使用详解
    将Redhat,CentOS,Ubuntu虚拟机的IP设为静态IP的方法
    Hive中的Order by与关系型数据库中的order by语句的异同点
    Hadoop namenode节点无法启动的问题解决
    虚拟机上的Ubuntu 文件系统成为只读模式的解决办法
    Hive参数的临时设置和永久性设置
    hive动态分区和混合分区
    MongoDB之Linux下的安装
  • 原文地址:https://www.cnblogs.com/tekkaman/p/3530503.html
Copyright © 2011-2022 走看看