Giter VIP home page Giter VIP logo

canvallax's People

Contributors

shshaw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

canvallax's Issues

Canvallax Spritesheet

Snippet for using spritesheets with Canvallax

(function(win){

  win._clx = win._clx || [];
  win._clx.push(function(canvallax){

    'use strict';
    
    var _originalDraw = canvallax.Image.fn.draw;    
      
    canvallax.Image.fn.draw = function(ctx,coords){
    
      if ( this.sprite && this.image ) {
        ctx.drawImage(this.image, this.sprite[0], this.sprite[1], this.width, this.height, coords[0], coords[1], this.width, this.height);
      } else { 
        _originalDraw.apply(this,arguments); 
      }
   
    };

  });

})(this);

var spriteSheet = canvallax.Image({ src: './spritesheet.png' });
var sprite = spriteSheet.clone({ sprite: [frame.x, frame.y, frame.width, frame.height] });

Canvallax clouds

Thank you for your work, I really liked it and have included it on the site.
http://vvl99.narod.ru/Clouds.html
If you reload the page, the code from Canvallax v.1 and Canvallax v.2 will be used randomly:
if (type) { ctx.translate(randomRange(halfw, width - (w * maxScale * 1.3)), randomRange(halfh + halfh / 4, height - (h * maxScale))) } else { ctx.translate( weightedRandom( width - (w * randScale), 5 ), weightedRandom( height- (h * randScale), 5) ) };
Which corresponds to:
location.hash = type ? "puffy_clouds" : "cumulus_clouds";

  • time:
    "morning", "noon", "twilight", "evening", "night", "afternoon".
    I tried to vary the clouds as much as possible depending on the time of day.

Cavallax with the cloud example is not working

I took the example shown in codepen: http://codepen.io/shshaw/pen/ZbExyV
and I get an error: Canvallax.js:80 Uncaught TypeError: Cannot read property 'scrollLeft' of null
Looks like the line body = doc.body gets a null since doc.body is null

without changing anything, just copying the example from there and it is not working.
my html looks like that (I omitted the html and head tags):

<body>
<script>
var can = Canvallax({
        className: 'bg-canvas',
        damping: 40
    });
/* then the //Clouds part and the rest of the Canvallax example */
</script>
</body>

It doesn't even get to the clouds part... What am I missing??

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.