Git Product home page Git Product logo

cocos2d-x-shake-action's Introduction

Cocos2d-x Shake Action

What is this?

A shaking action for Cocos2d-x. It shakes the cocos2d node.

How and what to use

I recommend you to use Simplex Noise version than Perlin Noise.
Clone the repo and copy source code to your project.

// Perline Noise
auto sprite = cocos2d::Sprite::create("HelloWorld.png");
sprite->runAction(ActionShake::create(2.0f/*Duration*/, 40.0f/*speed*/, 40.0f/*magnitude*/));
// Simplex Noise
auto sprite = cocos2d::Sprite::create("HelloWorld.png");
sprite->runAction(Shake::create(2.0f/*Duration*/, 40.0f/*speed*/, 40.0f/*magnitude*/));

Preview

Preview
i.e.) Duration = 2.0f, Magnitude = 40.0f, Speed = 40.0f

Reference

Perlin Noise.
Simplex Noise and Reference.

Note

  • Uses Perlin Noise and Simplex Noise
  • Perlin Noise shake tested on Cocos2d-x 3.10 version.
  • Simplex Noise shake tested on Cocos2d-x 3.14.1 version.
  • Can be used like other built-in actions. Read comment in code for details.
  • I did not write the core algorithm for Perlin Noise, but made it to work on Cocos2d-x 3.10 version because none of them out on the internet worked as described.
  • I followed the pdf reference linked above to implement Simplex Noise.

cocos2d-x-shake-action's People

Contributors

bsy6766 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.