Giter VIP home page Giter VIP logo

canvallax's Introduction

Canvallax 2 is Coming

I've been working hard at improving the Canvallax API & feature set, and it's almost ready for prime time. Check out the v2.0.0 branch to try out the upcoming features. File any feedback or bugs under Issues

What's new in 2.0.0?

  • Built in animation engine with .to, .from and .fromTo methods on all elements.
  • Better Tracker setup and DOM element tracking
  • Full documentation with JSDoc
  • Any-shape polygon ( var star = canvallax.Polygon({ points: [[80, 0], [100, 50], [160, 55], [115, 95], [130, 150], [80, 120], [30, 150], [45, 95], [0, 55], [60, 50],'close'] }); )
  • Plugin support! Easily extend Canvallax with your own Elements, Methods & Trackers. Example Canvallax.Pattern & Canvallax.RoundedRectangle plugins included.
  • Canvallax.Ellipse to replace Canvallax.Circle, make round shapes of any size!
  • Canvallax.Group for keeping Elements linked together.

--

Canvallax.js

Easy parallax effects on <canvas>

Canvallax is a small (5.8kb minified, 2.1kb gzipped) dependency-free Javascript library for managing elements on <canvas>. Support is built-in for:

  • Parallax Scrolling, with optional damping to smooth motions
  • Pointer Tracking
  • Distance/scaling
  • Images on Canvas, from URLs or nodes (<img />, <canvas />, etc) with Canvallax.Image
  • Common shapes (Canvallax.Circle, Canvallax.Polygon and Canvallax.Rectangle)
  • Element stacking with zIndex
  • Fixed position Elements
  • Element cloning

The Canvallax library is primarily meant to help with managing individual elements on canvas with unified positioning, scale and scroll effects. Some canvas knowledge will be needed for more advanced implementations like custom elements and animation, though most effects can be achieved with the built-in functionality.

Examples

Starfield Header Image Slice Pointer Tracking Parallax Sky Background Falling Hexagon Mask transformOrigin

View the CodePen collection of Canvallax demos

Basic Usage

Create a new Canvallax instance either by calling new Canvallax() or Canvallax(), either will work. First variable is an optional object containing options, the default values are shown below.

  var myCanvallax = Canvallax(),
      img = Canvallax.Image('image.jpg'),
      circle = Canvallax.Circle(),
      triangle = Canvallax.Polygon({
        sides: 3
      }),
      square = Canvallax.Rectangle({
        width: 100,
        height: 100
      });
  
  myCanvallax.add(img,circle,triangle,square);
  

Read the Canvallax Wiki for full documentation.

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.