post list

2014년 9월 13일 토요일

스프라이트킷 3. 액션 사용하기 (SKAction클래스)

액션은 화면에서 노드가 수행하는 움직임이다
회전이나  페이드인/아웃 움직임, 크기변화 등을 수행 할 수 있다.

일단 skAction class reference 입니다.


Tasks


Creating Actions That Move Nodes


Creating Actions That Rotate Nodes


Creating Actions That Change a Node’s Animation Speed


Creating Actions That Change a Node’s Scale


Creating Actions That Change a Node’s Transparency


Creating Actions That Change a Sprite Node’s Content


Playing Sounds


Removing Nodes from the Scene


Creating Actions That Perform Actions on a Node’s Child


Creating Actions That Combine or Repeat Other Actions


Creating an Action to Introduce a Delay into a Sequence


Creating Custom Actions


Reversing an Action


Inspecting an Action’s Animation Properties


액션은 별로 설명할게 없어요
일단 property에 관해서 설명합니다

duration 
액션이 수행되는데 걸리는 시간이에요 

speed
액션이 얼마나 빨리 수행되는지 정해주는 프로퍼티입니다. 
기본값은 1이고 2를 넣으면 두배로 빨리 액션이 수행되겠네요

 timingMode
액션이 점점 빨리지던지,  빨라졌다 느려지고, 점점 느려지는 것들을 정해줍니다.


액션은 sequence, group, repeating액션으로 구분할수 있습니다.
sequence 는 차례차례 액션을 수행하게 할수 있고 , group은 병렬적수행을 할수 있고 , 
repeating Action은 반복합니다. 

바로 예제를 보도록하겠습니다. 
텍스쳐 아틀라스 사용하기 에서 작성했던 예제를 사용하도록 하겠스빈다.

나루토를 터치하면   회전하고   다른 곳을 터치하면 그 곳으로 그림자분신술하는 예제입니다.
기존 코드를 좀 바꿔줄 필요가 있습니다. 
아래 코드처럼 _narutoNode를 인스턴스 변수로 선언해주고 
기존 narutoNode를 _narutoNode로 대체합니다.


메크로를 선언합니다.

naruto_aniMyScene.m에 아래 코드를 추가해줍니다.


실행결과입니다.












댓글 2개:

  1. Man's Titanium Braided Sticker - Titanium Arts
    Man's Titanium Braided Sticker - Titanium Arts. Manufacturer: SEGA. Price: $0.20. Manufacturer: SEGA. Sold out. apple watch stainless steel vs titanium Quantity: 1. Add to ion chrome vs titanium Cart. Rating: 4.5 titanium tent stove · ‎11 titanium or ceramic flat iron reviews · ‎$0.20 titanium sheet metal · ‎Out of stock

    답글삭제