Shape Text オブジェクトは同じ偉さ
StageオブジェクトにShapeオブジェクトもTextオブジェクトも追加できるが、ShapeオブジェクトにTextオブジェクトを追加することはできない。なぜならShapeオブヘクトとTextオブジェクトは同じ偉さ?だから。
やりたければ、コンテナーを使う。
http://createjs.com/docs/easeljs/files/easeljs_display_Text.js.html#l82
Text.の中身がどうなっているか定義されているファイル。どうやらこれを見れば、何がどうやれば可能なのか、全て書いてある模様。ここから仕様を確認しているようだ。結局JSのライブラリである以上、全てはコンストラクタ、メソッド、オブジェクト、継承などを駆使して、JSが書かれているだけ。何をどこから継承しているのか、どんなコンストラクタなのか、どんなメソッドを起動しているのか、わかればいい。(といってもそれは簡単ではないが…)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
function Text(text, font, color) { this.DisplayObject_constructor(); // public properties: /** * The text to display. * @property text * @type String **/ this.text = text;//オブジェクト名.textで中身にアクセス可能。変更や取り出し。 /** * The font style to use. Any valid value for the CSS font attribute is acceptable (ex. "bold 36px Arial"). * @property font * @type String **/ this.font = font;//フォントをあとから変えるのも可能。 /** * The color to draw the text in. Any valid value for the CSS color attribute is acceptable (ex. "#F00"). Default is "#000". * It will also accept valid canvas fillStyle values. * @property color * @type String **/ this.color = color; |
1 comment