GithubHelp home page GithubHelp logo

demo-camera's Introduction

Camera Demo for Cocos Creator

In this project we demonstrate how to control cc.Camera in your action/platform game. There're several scripts you want to take a look at:

  • CameraControl.js: Controls the camera's movement and zoom ratio according to your need.
  • HeroControl.js: Physics based player control script, borrowed from Physics Example
  • Global.js: We enable physics system in this global script.

Camera Control Pattern

In CameraControl component we implemented following method to control camera:

  • Smooth Follow: follow the target smoothly when the target is too far away from camera.
  • Speed Zoom: Zoom out the camera when player moves fast. Zoom back in when player slow down.
  • Jump Zoom: The higher player jumps, the larger view he can see through camera.
  • Overview: aka multi-targets, the camera will show all listed target and automatically zoom out to fit all of them on screen.
  • Camera Shake: Use animation clip to move the camera node up and down for camera shake effect.
  • Pointer Pan: Move your mouse to pan the camera around the player.
  • Boundaries: Set boundaries for camera so it won't move across border.

demo-camera's People

Contributors

nantas avatar

Stargazers

w.jin avatar

Watchers

w.jin 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.