├── src ├── ansii_palette.coffee ├── ease_default.coffee ├── display_container.coffee ├── sprite.coffee ├── bitmap.coffee ├── utils.coffee ├── text_field.coffee ├── tween_command.coffee ├── renderer.coffee ├── display_container_mixin.coffee ├── tween.coffee ├── pixel_sprite.coffee ├── stacked_loader.coffee ├── display_object.coffee ├── shape.coffee └── stage.coffee ├── .rvmrc ├── demos ├── logo.png ├── horse.ogg ├── demo.css ├── demo.html ├── logo.spr ├── demo.coffee └── demo.js ├── Gemfile ├── Guardfile ├── Gemfile.lock ├── make ├── LICENSE └── README.rdoc /src/ansii_palette.coffee: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.rvmrc: -------------------------------------------------------------------------------- 1 | rvm 1.9.3@canvas_library --create 2 | -------------------------------------------------------------------------------- /demos/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkln/canvas_library/HEAD/demos/logo.png -------------------------------------------------------------------------------- /demos/horse.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dkln/canvas_library/HEAD/demos/horse.ogg -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | group :development do 4 | gem 'guard-coffeescript' 5 | end 6 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | # 3 | guard 'coffeescript', :input => 'demos' 4 | guard 'coffeescript', :input => 'src', :output => 'lib' 5 | -------------------------------------------------------------------------------- /src/ease_default.coffee: -------------------------------------------------------------------------------- 1 | EaseDefault = (t, b, c, d) -> 2 | -c * (t /= d) * (t - 2) + b 3 | 4 | @CanvasLibrary ||= {} 5 | @CanvasLibrary.EaseDefault = EaseDefault 6 | -------------------------------------------------------------------------------- /src/display_container.coffee: -------------------------------------------------------------------------------- 1 | class DisplayContainer 2 | draw: (context, drawHitarea) -> 3 | true 4 | 5 | include DisplayContainer, CanvasLibrary.DisplayContainerMixin 6 | 7 | @CanvasLibrary ||= {} 8 | @CanvasLibrary.DisplayContainer = DisplayContainer 9 | -------------------------------------------------------------------------------- /src/sprite.coffee: -------------------------------------------------------------------------------- 1 | class Sprite extends CanvasLibrary.Shape 2 | constructor: -> 3 | super() 4 | @children = [] 5 | 6 | include Sprite, CanvasLibrary.DisplayContainerMixin 7 | 8 | @CanvasLibrary ||= {} 9 | @CanvasLibrary.Sprite = Sprite 10 | -------------------------------------------------------------------------------- /demos/demo.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #aaa; 3 | } 4 | 5 | div { 6 | position: absolute; 7 | width: 644px; 8 | height: 484px; 9 | margin-left: -320px; 10 | margin-top: -240px; 11 | left: 50%; 12 | top: 50%; 13 | padding: 2px; 14 | border: solid 2px #fff; 15 | background-color: #fff; 16 | } 17 | -------------------------------------------------------------------------------- /src/bitmap.coffee: -------------------------------------------------------------------------------- 1 | class Bitmap extends CanvasLibrary.DisplayObject 2 | constructor: (@imageData) -> 3 | super() 4 | 5 | draw: (context, drawHitarea) -> 6 | if @imageData 7 | if @drawHitarea 8 | context.rect 0, 0, @imageData.width, @imageData.height 9 | else 10 | context.drawImage @imageData, 0, 0 11 | 12 | @CanvasLibrary ||= {} 13 | @CanvasLibrary.Bitmap = Bitmap 14 | -------------------------------------------------------------------------------- /demos/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 |