Example #1
0
File: main.go Project: govlas/pixi
package main

import (
	"github.com/Archs/js/dom"
	"github.com/Archs/js/raf"
	"github.com/Archs/pixi"
	"math"
	"math/rand"
)

var (
	stage          = pixi.NewContainer()
	sprites        = pixi.NewContainer()
	render         = pixi.AutoDetectRenderer(800, 600)
	renderTexture  = pixi.NewRenderTexture(render, render.Width, render.Height, pixi.ScaleModes.Default, 1)
	renderTexture2 = pixi.NewRenderTexture(render, render.Width, render.Height, pixi.ScaleModes.Default, 1)
	renderSprit    = pixi.NewSprite(renderTexture.Texture)

	count = 0.0
)

var fruits = []string{
	"assets/spinObj_01.png",
	"assets/spinObj_02.png",
	"assets/spinObj_03.png",
	"assets/spinObj_04.png",
	"assets/spinObj_05.png",
	"assets/spinObj_06.png",
	"assets/spinObj_07.png",
	"assets/spinObj_08.png",
}
Example #2
0
File: main.go Project: govlas/pixi
package main

import (
	"github.com/Archs/js/dom"
	"github.com/Archs/js/raf"
	"github.com/Archs/pixi"
	"github.com/gopherjs/gopherjs/js"
	"math"
)

var (
	stage    = pixi.NewContainer()
	renderer = pixi.AutoDetectRenderer(800, 600)
)

func run(t float64) {
	raf.RequestAnimationFrame(run)
	renderer.Render(stage)
}

func main() {
	txt := pixi.NewText("A Text Object will create a line or multiple lines of text. \nTo split a line you can use '\\n' in your text string, or add a wordWrap property set to true and and wordWrapWidth property with a value in the style object.", js.M{
		"font":               "36px Arial bold italic",
		"fill":               "#F7EDCA",
		"stroke":             "#4a1850",
		"strokeThickness":    5,
		"dropShadow":         true,
		"dropShadowColor":    "#000000",
		"dropShadowAngle":    math.Pi / 6,
		"dropShadowDistance": 6,
		"wordWrap":           true,
Example #3
0
File: main.go Project: govlas/pixi
package main

import (
	"math"
	"math/rand"

	"github.com/Archs/js/raf"
	"github.com/Archs/pixi"

	"github.com/gopherjs/gopherjs/js"
)

var (
	stage    = pixi.NewContainer()
	renderer = pixi.AutoDetectRenderer(800, 600)
	group    = pixi.NewContainer()
	aliens   = make([]*pixi.Sprite, 0)
	count    = 0.0
)

func onAssetsLoaded() {
	frames := []string{
		"eggHead.png",
		"flowerTop.png",
		"helmlok.png",
		"skully.png",
	}

	for i := 0; i < 100; i++ {
		alien := pixi.SpriteFromFrame(frames[i%4])
		alien.Tint = rand.Uint32()