Commit 79ed176e by doszhang

dos

parent 3735899e
...@@ -47,6 +47,7 @@ if ($('div').length > 0) { ...@@ -47,6 +47,7 @@ if ($('div').length > 0) {
var myCanvas; var myCanvas;
var ctx; var ctx;
var imgInfo = {}; var imgInfo = {};
var nowTemplate = 1;
// var username = ''; // var username = '';
preloadimages(preloadImageList, function () { preloadimages(preloadImageList, function () {
...@@ -71,6 +72,9 @@ $(document).ready(function () { ...@@ -71,6 +72,9 @@ $(document).ready(function () {
$('.btn-go').on('click',homeBtnGoHandleClick); $('.btn-go').on('click',homeBtnGoHandleClick);
$('.btn-slideleft').on('click',slidePrevTemplate);
$('.btn-slideright').on('click',slideNextTemplate);
$('[name=btn-tocreate]').change(function() { $('[name=btn-tocreate]').change(function() {
initCanvas(); initCanvas();
imgInfo.rotation = 0; imgInfo.rotation = 0;
...@@ -180,6 +184,26 @@ function homeBtnGoHandleClick() ...@@ -180,6 +184,26 @@ function homeBtnGoHandleClick()
$('.btn-tocreate,.copywriting2').delay(200).fadeIn(300); $('.btn-tocreate,.copywriting2').delay(200).fadeIn(300);
} }
function slidePrevTemplate() {
if(nowTemplate - 1 <= 0)
{
nowTemplate = 6;
}
nowTemplate -= 1;
$('.template').hide();
$('.template' + nowTemplate).show();
}
function slideNextTemplate() {
if(nowTemplate + 1 >= 6)
{
nowTemplate = 0;
}
nowTemplate += 1;
$('.template').hide();
$('.template' + nowTemplate).show();
}
function drawImage() { function drawImage() {
ctx.save(); ctx.save();
ctx.clearRect(0, 0, myCanvas.width, myCanvas.height); ctx.clearRect(0, 0, myCanvas.width, myCanvas.height);
...@@ -215,6 +239,11 @@ function getManBase64() { ...@@ -215,6 +239,11 @@ function getManBase64() {
return myCanvas.toDataURL('image/png'); return myCanvas.toDataURL('image/png');
} }
function initGame() {
$('.template').hide();
$('.template' + nowTemplate).show();
}
function txtDraw(ctx, content, x, y, fontsize, fontweight, color) { function txtDraw(ctx, content, x, y, fontsize, fontweight, color) {
x = x * 4; x = x * 4;
y = y * 4; y = y * 4;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment