Skip to content

Commit

Permalink
add some templates
Browse files Browse the repository at this point in the history
  • Loading branch information
naeioi committed Apr 22, 2015
1 parent 1fe5ea4 commit f1523ac
Show file tree
Hide file tree
Showing 87 changed files with 390 additions and 9 deletions.
4 changes: 2 additions & 2 deletions js/Controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ define(['createjs', 'jquery', 'ImageText', 'TextLine', 'Model'], function(create

var p = Controller.prototype;

p.load = function(src){
p.load = function(src, mode){
var self = this;
this.stage.removeAllChildren();

var model = new createjs.Model();
//model.shadow = new createjs.Shadow('#000000', 5, 5, 10);
this.model = model;
var def = model.load(src, 'origin');
var def = model.load(src, mode);

def = def.then(function(){
var bound = model.getBounds();
Expand Down
7 changes: 4 additions & 3 deletions js/ImageText.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ define(['createjs', 'TextLine'], function(createjs) {
this.fontSize = size || 20;
this.fontFamily = family || "";
this.color = color || "000000";
this.lineHeight = 200; //___% of font-size
this.lineHeight = 220; //___% of font-size

this.texts = [];
this.name = "ImageText"; //click事件冒泡到model时用于判断是否是点击了文字
Expand Down Expand Up @@ -117,6 +117,7 @@ define(['createjs', 'TextLine'], function(createjs) {

if (self.dir == 0) {
var _h = self.fontSize * self.lineHeight / 100;
var n = arr.length;
switch (self.reg) {
case 0:
textline.set({
Expand All @@ -133,13 +134,13 @@ define(['createjs', 'TextLine'], function(createjs) {
case 2:
textline.set({
x: -bound.width,
y: -i * _h
y: -(n-i-1) * _h
});
break;
case 3:
textline.set({
x: 0,
y: -i * _h
y: -(n-i-1) * _h
});
break;
case 4:
Expand Down
4 changes: 2 additions & 2 deletions js/TextLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ define(['createjs'], function(createjs) {
var _w = img.width, _h = img.height;
var bitmap;

_can.width = _w+2;
_can.height = _h+2;
_can.width = _w;
_can.height = _h;

ctx.drawImage(img, 0, 0);

Expand Down
2 changes: 1 addition & 1 deletion js/test_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require(['Controller'], function() {

//通过load方法从main.json文件中读取模板并放到canvas中
//load返回jQuery的promise对象,方便异步操作
controller.load('templates/half_pic/complete/half_pic.json');
controller.load('templates/deep_bg_pure_text/complete/deep_bg_pure_text.json', 'origin' );

/*
--- 测试实时输入 ---
Expand Down
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
74 changes: 74 additions & 0 deletions templates/deep_bg_pure_text/complete/deep_bg_pure_text.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"demo_width": 700,
"demo_height": 990,
"origin_width": 1985,
"origin_height": 2807,
"bg_manualable": false,
"bg": [
{"src": "blue.png"},
{"src": "black.png"},
{"src": "brown.png"},
{"src": "red.png"},
{"src": "green.png"}
],
"elements": [],
"texts": [
{
"font": "ffh.TTF",
"content": "数学社",
"size": 130,
"dir": 1,
"reg": 1,
"x": 1319,
"y": 613
},
{
"font": "ffh.TTF",
"content": "在这里 你可以找到\n志趣相投的朋友\n在这里 你可以探索\n最美丽的科学的秘密\n我们期待 最独特的你",
"size": 49,
"dir": 0,
"reg": 2,
"x": 1241,
"y": 1077
},
{
"font": "ffh.TTF",
"content": "报名信息",
"size": 93,
"dir": 1,
"reg": 0,
"x": 623,
"y": 1265
},
{
"font": "ffh.TTF",
"content": "面试时间:三月二十四日\n地点:二教101\n报名请关注微信\n@爱数学",
"size": 60,
"dir": 0,
"reg": 0,
"x": 809,
"y": 1271
},
{
"font": "ffh.TTF",
"content": "不见不散",
"size": 60,
"dir": 0,
"reg": 0,
"x": 827,
"y": 1989
},
{
"font": "ffh.TTF",
"content": "XX协会",
"size": 58,
"dir": 0,
"reg": 0,
"x": 54,
"y": 2702
}
],
"text_color": [["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"],["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"],["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"],["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"],["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"],["FFFFFF","FFFFFF","FFFFFF","FFFFFF","FFFFFF","000000"]],
"set_name": ["blue", "black", "brown", "red", "green"]

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/deep_bg_pure_text/complete/demo/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes
File renamed without changes.
Binary file added templates/half_pic_column/colorset/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions templates/half_pic_column/colorset/colorset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"classes":[
"templates/chinese/colorset/green.png",
"templates/chinese/colorset/red.png",
"templates/chinese/colorset/blue.png",
"templates/chinese/colorset/yellow.png",
"templates/chinese/colorset/qing.png"
],
"nameArray":
[
"colorbox-green",
"colorbox-red",
"colorbox-blue",
"colorbox-yellow",
"colorbox-qing"
]
}
Binary file added templates/half_pic_column/colorset/green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/half_pic_column/colorset/qing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/half_pic_column/colorset/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added templates/half_pic_column/colorset/yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
38 changes: 38 additions & 0 deletions templates/half_pic_column/mainThumbnail/demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"demo_width": 700,
"demo_height": 990,
"origin_width": 1985,
"origin_height": 2807,
"bg_manualable": false,
"bg": [
{"src": "red.png"},
{"src": "qing.png"},
{"src": "blue.png"},
{"src": "green.png"},
{"src": "yellow.png"}
],
"elements": [],
"texts": [
{
"font": "kxzd.otf",
"content": "桂林",
"size": 135,
"dir": 1,
"reg": 4,
"x": 530,
"y": 270
},
{
"font": "y.ttf",
"content": "桂林山水甲天下,\n玉碧罗青意可参.",
"size": 58,
"dir": 1,
"reg": 4,
"x": 289,
"y": 644
}
],
"text_color": [["001100"],["110011"],["110011"],["110011"],["110011"]],
"set_name": ["red", "qing", "blue", "green", "yellow"]

}
Binary file added templates/half_pic_column/mainThumbnail/main.jpg
5 changes: 5 additions & 0 deletions templates/half_pic_column/mainThumbnail/thumb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"classes":[
"templates/chinese/mainThumbnail/main.jpg"
]
}
Binary file added templates/half_pic_row/colorset/blue.png
17 changes: 17 additions & 0 deletions templates/half_pic_row/colorset/colorset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"classes":[
"templates/chinese/colorset/green.png",
"templates/chinese/colorset/red.png",
"templates/chinese/colorset/blue.png",
"templates/chinese/colorset/yellow.png",
"templates/chinese/colorset/qing.png"
],
"nameArray":
[
"colorbox-green",
"colorbox-red",
"colorbox-blue",
"colorbox-yellow",
"colorbox-qing"
]
}
Binary file added templates/half_pic_row/colorset/green.png
Binary file added templates/half_pic_row/colorset/qing.png
Binary file added templates/half_pic_row/colorset/red.png
Binary file added templates/half_pic_row/colorset/yellow.png
Binary file added templates/half_pic_row/complete/demo/blue.png
Binary file added templates/half_pic_row/complete/demo/green.png
Binary file added templates/half_pic_row/complete/demo/pink.png
Binary file added templates/half_pic_row/complete/demo/white.png
Binary file added templates/half_pic_row/complete/demo/yellow.png
52 changes: 52 additions & 0 deletions templates/half_pic_row/complete/half_pic_row.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"demo_width": 700,
"demo_height": 990,
"origin_width": 1191,
"origin_height": 1684,
"bg_manualable": false,
"bg": [
{"src": "blue.png"},
{"src": "green.png"},
{"src": "pink.png"},
{"src": "white.png"},
{"src": "yellow.png"}
],
"elements": [],
"texts": [
{
"font": "chsj.TTF",
"content": "播种希望",
"size": 130,
"dir": 0,
"reg": 3,
"x": 127,
"y": 795
},
{
"font": "zxh.ttf",
"content": "你的一个小小的行动\n也许就播下了一粒种子\n也许将来的这里将绿树成林\n支教行动 我们需要你的加入",
"size": 40,
"dir": 0,
"reg": 0,
"x": 151,
"y": 1076
},{
"font": "ffh.TTF",
"content": "二月一日\n百年讲堂门口\n不见不散",
"size": 40,
"dir": 0,
"reg": 1,
"x": 1045,
"y": 88
},{
"font": "zxh.ttf",
"content": "北京大学学生会",
"size": 30,
"dir": 0,
"reg": 1,
"x": 1161,
"y": 1605
}
],
"set_name": ["blue", "green", "pink", "white", "yellow"]
}
Binary file added templates/half_pic_row/complete/origin/blue.png
Binary file added templates/half_pic_row/complete/origin/green.png
Binary file added templates/half_pic_row/complete/origin/pink.png
Binary file added templates/half_pic_row/complete/origin/white.png
Binary file added templates/half_pic_row/complete/origin/yellow.png
38 changes: 38 additions & 0 deletions templates/half_pic_row/mainThumbnail/demo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"demo_width": 700,
"demo_height": 990,
"origin_width": 1985,
"origin_height": 2807,
"bg_manualable": false,
"bg": [
{"src": "red.png"},
{"src": "qing.png"},
{"src": "blue.png"},
{"src": "green.png"},
{"src": "yellow.png"}
],
"elements": [],
"texts": [
{
"font": "kxzd.otf",
"content": "桂林",
"size": 135,
"dir": 1,
"reg": 4,
"x": 530,
"y": 270
},
{
"font": "y.ttf",
"content": "桂林山水甲天下,\n玉碧罗青意可参.",
"size": 58,
"dir": 1,
"reg": 4,
"x": 289,
"y": 644
}
],
"text_color": [["001100"],["110011"],["110011"],["110011"],["110011"]],
"set_name": ["red", "qing", "blue", "green", "yellow"]

}
Binary file added templates/half_pic_row/mainThumbnail/main.jpg
5 changes: 5 additions & 0 deletions templates/half_pic_row/mainThumbnail/thumb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"classes":[
"templates/chinese/mainThumbnail/main.jpg"
]
}
Binary file added templates/light_bg_pure_text/colorset/blue.png
17 changes: 17 additions & 0 deletions templates/light_bg_pure_text/colorset/colorset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"classes":[
"templates/chinese/colorset/green.png",
"templates/chinese/colorset/red.png",
"templates/chinese/colorset/blue.png",
"templates/chinese/colorset/yellow.png",
"templates/chinese/colorset/qing.png"
],
"nameArray":
[
"colorbox-green",
"colorbox-red",
"colorbox-blue",
"colorbox-yellow",
"colorbox-qing"
]
}
Binary file added templates/light_bg_pure_text/colorset/green.png
Binary file added templates/light_bg_pure_text/colorset/qing.png
Binary file added templates/light_bg_pure_text/colorset/red.png
Binary file added templates/light_bg_pure_text/colorset/yellow.png
Loading

0 comments on commit f1523ac

Please sign in to comment.