Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

amoyjs/query

Repository files navigation

query

A jQuery-like pixi.js selector.

NPM Version NPM Downloads size

Usage

import { Application, Text, Container, Sprite } from 'pixi.js'
import query from '@amoy/query'

const game = new Application({
    width: window.innerWidth,
    height: window.innerHeight,
})

query(game.stage)

const t1 = new Text('Hello World.', {
    fill: 0xffffff,
})
t1.class = 'text'
t1.x = 200
t1.y = 200
const t2 = new Text('Hello World.', {
    fill: 0xffffff,
})
t2.name = 'text'
t2.x = 300
t2.y = 300
const s1 = Sprite.from(document.querySelector('img'))
game.stage.addChild(t1, t2, s1)

$('[class=text]') // t1
// or
$('.text') // t1
$('[name=text]') // t2

Contribution

How to extend a method:

import query from '@amoy/query'

query.extend({
    methodName() {
        for (let i = 0; i < this.length; i++) {
            // this[i]
            // do something on `this[i]`
        }
    }
})

$('sprite').methodName()

About

A jQuery-like pixi.js selector.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.