Code Monkey home page Code Monkey logo

pixi.dart's Introduction

pixi.dart

A Dart wrapper for PixiJS.

The version number of this package mirrors that of the PixiJS library it wraps. An official build of minified pixijs is provided as part of the package. You must link to this in your root HTML file (e.g. index.html) before referencing your Dart application:

	<script src="packages/pixi/js/pixi.min.js"></script>
	<script defer src="index.dart.js"></script>

The PixiJS documentation can be used as reference with a few exceptions such as the loading of shaders (see the custom-filter example).

Remember to wrap all callback functions that are passed to JS with allowInterop().

Usage

import 'dart:html' hide Point;
import 'package:pixi/pixi.dart';
import 'package:js/js.dart';

class BunnyExample
{
	Application app	= Application();
	Sprite bunny	= Sprite.fromImage('bunny.png');

	BunnyExample()
	{
		document.body.append(app.view);

		this.bunny
			..anchor 	= Point(0.5, 0.5)
			..position	= Point(200, 150);

		app.stage.addChild(this.bunny);
		app.ticker.add(allowInterop(
			(_) => this.bunny.rotation += 0.1
		));
	}
}

void main()
{
	new BunnyExample();
}

pixi.dart's People

Contributors

parnham avatar alexanderzeillinger avatar

Watchers

James Cloos 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.