Skip to content

Commit

Permalink
🎨 add bgimage attribute for all elements
Browse files Browse the repository at this point in the history
  • Loading branch information
akira-cn committed Jul 31, 2018
1 parent 15b36df commit 97558e3
Show file tree
Hide file tree
Showing 27 changed files with 3,075 additions and 2,041 deletions.
530 changes: 360 additions & 170 deletions dist/spritejs.es6.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/spritejs.es6.min.js

Large diffs are not rendered by default.

2,052 changes: 1,134 additions & 918 deletions dist/spritejs.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/spritejs.min.js

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion docs/en/changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Change Log

## [2.6.0][2018-07-31]

### feature

- Add `bgimage` attribute for all elements

### bug fixed

- Fixed label with both height and width fixed display lineBreak error.
- Fixed textAlign center or right in multi-line text display error.

## [2.5.2][2018-07-27]

### 改进
### feature

- Add `letterSpacing` and `textIndent` attributes for Label.
- Add `scrollLeft` and `scrollTop` attributes for Group.
Expand Down
55 changes: 55 additions & 0 deletions docs/js/bgimage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }

var _spritejs = spritejs,
Scene = _spritejs.Scene,
Label = _spritejs.Label,
Resource = _spritejs.Resource;
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var scene, layer, s;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
scene = new Scene('#bgimage', { viewport: ['auto', 'auto'], resolution: [1540, 600] });
layer = scene.layer();
_context.next = 4;
return Resource.loadTexture({ id: '9scale', src: 'https://p2.ssl.qhimg.com/t01c18f4e677c09a87e.jpg' });

case 4:
s = new Label('测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试');

s.attr({
// textures: [img],
// textAlign: 'center',
font: '34px "宋体"',
anchor: 0.5,
border: [6, 'black'],
pos: [770, 300],
size: [250, 300],
bgcolor: 'blue',
lineBreak: 'normal',
bgimage: {
id: '9scale',
display: '.9',
clip9: 60
// offset: [0, 50],
},
padding: 60
});
layer.append(s);

s.animate([{ width: 250 }, { width: 500 }], {
duration: 5000,
iterations: Infinity,
direction: 'alternate'
});

case 8:
case 'end':
return _context.stop();
}
}
}, _callee, this);
}))();
Loading

0 comments on commit 97558e3

Please sign in to comment.