• 検索結果がありません。

Dart StargeXL kurano

N/A
N/A
Protected

Academic year: 2018

シェア "Dart StargeXL kurano"

Copied!
32
0
0

読み込み中.... (全文を見る)

全文

(1)

Dart + StageXL

GDG DevFest Japan 2014 Spring in Kyoto

2014.4.6

GDG 京都 文子

(2)

自己紹介

主 : UI / UX 設計

Web (画面 ン )

PC ー ョン

組込 機器

(家電 医療機器 ン等

そ 前 ち 変わ たキ

臨床検査技師

GDG 京都 ネー ー

Blog:

http://ofuku.blog.so-net.ne.jp

(3)

Dart

❖ ー ンソー 開発

❖ ベー ー ョン 開発可能

❖ 構造化 ン 言語

ベー ョ ン ン

JabaScript 変換 実行 可能

❖ Jave, C#, JavaScript 良く似た文法

❖ ー ョン 現在 v.1.3

(4)

Dart 基本 学ぶ

❖ Dart FLIGHT SCHOOL Kyoto

ン 先 資料

海賊

※ 口頭 話 いた部分 後日追記 た

(5)

StageXL for Dart

Starge ー ワー 用い ン ン

作成可能

Flash

❖ Flash API ActionScript3 近い書式

❖ HTML5 Canvas 動作

❖ StageXL for Dart

(6)

StageXL 構造

BitmapData

EventDispatcher

DisplayObject

Bitmap

Shape

InteractiveObject

SimpleButton

TextField

MovieClip

DisplayObjectContainer

Stage

Sprite

(7)

ActionScript Dart 比較

❖ http://www.stagexl.org/docs/actionscript-dart.ht

ml

(8)

StageXL

❖ http://www.stagexl.org/docs/api/stagexl.html

(9)

様々 見

❖ Dart for StageXL showcase

❖ Paticle Emitter

❖ Texture Packer

Flump

❖ Flash Professional - Toolkit for Dart

(10)

わともあれ Getting Start

参考URL:http://www.stagexl.org/docs/getting-started.html

(11)

Dart

❖ Getting and Installing Dart Is Easy!

(12)

Web ョン 作成

Dart Edit 起動

Menu File New Application

Application 入力

(13)

Pubspec.yaml 編集

Web ー ョン pubspec.yaml

(14)

Dependencies Stagexl 追加

Dependencies Add

Add dependency Enter name of package

stagexl 入力

Stagexl 選択 OK ン 押

(Particle 使う場合 stagexl_particle 選択 )

Command +S 保存

(15)

Packages 確認

❖ Stagexl packages 追加 確認

(16)

HTML 編集

❖ 元 ソー 部分

<div id=“sample_container_id”>

<p id="sample_text_id">Click me!</p>

</div>

❖ 変更部分

<canvas id="stage" width="800" height="600">

</canvas>

(17)

Dart 編集

❖ 記 赤い く ー 書 換え

import 'dart:html' as html;

import 'package:stagexl/stagexl.dart'; void main() {

// setup the Stage and RenderLoop var canvas =

html.querySelector('#stage'); var stage = new Stage(canvas);

var renderLoop = new RenderLoop(); renderLoop.addStage(stage);

// draw a red circle

var shape = new Shape();

shape.graphics.circle(100, 100, 60); shape.graphics.fillColor(Color.Red); stage.addChild(shape);

}

Getting Started –

Write your first Dart code ソー 引用

(18)

Display List

import 'dart:html' as html;

import 'package:stagexl/stagexl.dart'; void main() {

var canvas = html.querySelector('#stage'); var stage = new Stage(canvas);

var renderLoop = new RenderLoop(); renderLoop.addStage(stage);

var painting = new Painting(); painting.x = 40;

painting.y = 40;

stage.addChild(painting); }

class Painting extends DisplayObjectContainer {

final List<int> colors = [Color.Red, Color.Green, Color.Blue, Color.Brown];

Painting() {

var background = new BitmapData(400, 300, false, Color.BlanchedAlmond);

var backgroundBitmap = new Bitmap(background); addChild(backgroundBitmap);

for(var i = 0; i < colors.length; i++) {

var box = new BitmapData(100, 100, false, colors[i]); var boxBitmap = new Bitmap(box);

boxBitmap.x = 80 + i * 50; boxBitmap.y = 60 + i * 30; addChild(boxBitmap); }

}} 引用先URL:

http://www.stagexl.org/docs/wiki-articles.html?article=introduction

(19)

Display List

StageXL ン ン 表示

概念 依存

❖ Display List 画面 表示

含 階層 持

❖ 階層 構築

基本的 種類

The stage

Display Object Container

Display Object

(20)

The Stage

❖ ー 表示 階層 ー

❖ HTML5 canvas 要素

❖ 通常 ー う 高度

ー 利用

(21)

Display object container

❖ 名前 示 う Display Object 表示用

Stage 自体 Display Object

❖ ン 子 display Object 追加

Display Object 階層 構築可能

❖ ー 移動 た ン 回転 せた場合 べ

子たち そ 応 動作

❖ 表示 ン 削除 べ 子 削除

結果的 画面 消え

(22)

Display Object

❖ Display Object 画面 視覚的要素

❖ 最 基本的 Display Object Bitmap

Bitmap セ ー 含 2D ー た

非常 要 構成要素

❖ Display Object 階層 Display Object

行 管理 担当

❖ 子 Display Object

(23)

Resouce manager 利用

❖ ー や音楽 多く 異 ソー 使用

❖ そ 読 込 た ソー ネー ー 使用

可能

❖ ソー ネー ー 新 い ン ン 作成

べ ソー 名前 URL 追加

(24)

Resouce manager 利用例

❖ ソー ネー 画像 追加

❖ 各画像 供 い 画像 固有 名前 URL

付加

❖ ソー ネー べ ー 読 込 終

了 た 指定 た一意 名前 BitmapDatas

セ 可能

(25)

Resouce manager 画像

追加 た例

import 'dart:async';

import 'dart:html' as html;

import 'package:stagexl/stagexl.dart'; void main() {

var canvas = html.querySelector('#stage'); var stage = new Stage(canvas);

var renderLoop = new RenderLoop(); renderLoop.addStage(stage);

var resourceManager = new ResourceManager()

..addBitmapData("house", "../common/images/House.png") ..addBitmapData("sun", "../common/images/Sun.png") ..addBitmapData("tree", "../common/images/Tree.png"); resourceManager.load().then((_) {

var sun = new Bitmap(resourceManager.getBitmapData("sun")); var tree = new Bitmap(resourceManager.getBitmapData("tree")); var house = new

Bitmap(resourceManager.getBitmapData("house")); // Not shown: set x and y properties of sun, tree, house stage.addChild(sun);

stage.addChild(tree); stage.addChild(house); });

}

画像 ソー 引用

http://www.stagexl.org/docs/w iki-articles.html?article=introdu ction

(26)

利用 た簡単

❖ ー ー 利用

ー ー 調整

❖ 雪景色 画像 合わせ

(27)

※ソー ー - 後日追加分

library dart_snow;

import 'dart:html' as html;

import 'package:stagexl/stagexl.dart';

import 'package:stagexl_particle/stagexl_particle.dart'; void main() {

var stage = new Stage(html.querySelector('#stage'), webGL: true); var renderLoop = new RenderLoop();

renderLoop.addStage(stage);

//---

Config

//---

Resouce manager 雪景色 合わせ

//--- }

(28)

※ソー ー – Particle Emitter Config 部分

var particleConfig = { "maxParticles":2000, "duration":0,

"lifeSpan":5, "lifespanVariance":0, "startSize":8, "startSizeVariance":12, "finishSize":0, "finishSizeVariance":15, "shape":"circle", "emitterType":0,

"location":{"x":0, "y":0}, "locationVariance":{"x":96, "y":0}, "speed":161, "speedVariance":0,

"angle":0, "angleVariance":360, "gravity":{"x":0, "y":114},

"radialAcceleration":-14, "radialAccelerationVariance":127, "tangentialAcceleration":0,

"tangentialAccelerationVariance":0,

"minRadius":0, "maxRadius":100, "maxRadiusVariance":0, "rotatePerSecond":0, "rotatePerSecondVariance":0,

"compositeOperation":"lighter",

"startColor":{"red":1, "green":1, "blue":1, "alpha":1}, "finishColor":{"red":1, "green":1, "blue":1, "alpha":1} };

(29)

※ソー ー – Resouce Manager 部分

var resourceManager = new ResourceManager() ..addBitmapData("odou", "images/syokokuji.jpg"); resourceManager.load().then((_) {

// Snow scene

var odou = new Bitmap(resourceManager.getBitmapData("odou")); stage.addChild(odou);

// Particle of snow

var particleEmitter = new ParticleEmitter(particleConfig); particleEmitter.setEmitterLocation(600, -250);

stage.addChild(particleEmitter); stage.juggler.add(particleEmitter);

});

(30)

Dart 日本語資料

❖ Dart FLIGHT SCHOOL Kyoto 資料

Dart 基本 理解 立ち

資料 当日 ー 右側 ン あ

❖ 書籍 : ン 言語 Dart

Chris Buckett , うや 監修, ASCII出版

※ 注意: 記資料 StageXL for Dart 記述

(31)

Dart 英語参考 URL

❖ StageXL for Dart

❖ Dart FLIGHT SCHOOL

❖ Dart is a new platform for scalable web app

engineering.

❖ Dartisans (Google+ )

※後日追加分

(32)

清聴あ う い た

参照

関連したドキュメント

Also, for the sake of comparison we give the probability density functions of the terminal wealth of portfolios managed by the pure bond strategy, whose fraction of wealth invested

Viscous profiles for traveling waves of scalar balance laws: The uniformly hyperbolic case ∗..

図 3.1 に RX63N に搭載されている RSPI と簡易 SPI の仕様差から、推奨する SPI

mkdocs serve - Start the live-reloading docs server.. mkdocs build - Build the

An important new aspect of the results in [ 12 ] is that they enable one to obtain uniqueness of stationary distributions for stochastic delay differential equations when the

The hierarchy arising from finite state transducers classifies streams by a notion of degree that codifies their intrinsic, invariant infinite pattern.. With ‘intrinsic,

Also we define a soft S-contraction condition and study some fixed-point theorems on a complete soft S-metric space with necessary examples.. 2010 Mathematics Subject

ことで商店の経営は何とか維持されていた。つ まり、飯塚地区の中心商店街に本格的な冬の時 代が訪れるのは、石炭六法が失効し、大店法が