add image using url (all image format supported by canvas)
add custom canvas size
This commit is contained in:
parent
3faf647a76
commit
7827fe5ec7
2 changed files with 20 additions and 4 deletions
17
comicgen.js
17
comicgen.js
|
@ -1,8 +1,7 @@
|
||||||
var d = document;
|
var d = document;
|
||||||
var cg = {};
|
var cg = {};
|
||||||
var w = window.innerWidth * 0.8;
|
var w = parseInt(window.innerWidth * 0.8);
|
||||||
var h = window.innerHeight * 0.8;;
|
var h = parseInt(window.innerHeight * 0.8);
|
||||||
console.log('size : ' + w + ' x ' + h);
|
|
||||||
var canvas = $('#c');
|
var canvas = $('#c');
|
||||||
canvas.attr('width',w).attr('height',h);
|
canvas.attr('width',w).attr('height',h);
|
||||||
var c = canvas[0];
|
var c = canvas[0];
|
||||||
|
@ -11,6 +10,8 @@ var scene = new RB.Scene(c);
|
||||||
var fontFamily = "Domestic Manners, Arial, helvetica, sans serif";
|
var fontFamily = "Domestic Manners, Arial, helvetica, sans serif";
|
||||||
var pop = new Audio('pop.ogg');
|
var pop = new Audio('pop.ogg');
|
||||||
var currentObj = null;
|
var currentObj = null;
|
||||||
|
$('#newWidth').val(w);
|
||||||
|
$('#newHeight').val(h);
|
||||||
|
|
||||||
scene.add( scene.rect(w, h, 'white') );
|
scene.add( scene.rect(w, h, 'white') );
|
||||||
scene.update();
|
scene.update();
|
||||||
|
@ -177,7 +178,17 @@ cg.createTextFromInput = function(e){
|
||||||
pop.play();
|
pop.play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cg.createImageFromInput= function(e){
|
||||||
|
|
||||||
|
var key = e.keyCode || e.which;
|
||||||
|
var imgUrl = $('#newImgUrl').val();
|
||||||
|
|
||||||
|
if(key == 13){
|
||||||
|
|
||||||
|
cg.createImage(imgUrl);
|
||||||
|
$('#newImgUrl').val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
cg.saveImage = function(){
|
cg.saveImage = function(){
|
||||||
var data = c.toDataURL('png');
|
var data = c.toDataURL('png');
|
||||||
// $.ajax({
|
// $.ajax({
|
||||||
|
|
7
gege.css
7
gege.css
|
@ -53,7 +53,7 @@ margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2
|
h1, h2, h3
|
||||||
{
|
{
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
|
@ -243,3 +243,8 @@ text-decoration: underline;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#newWidth, #newHeight{
|
||||||
|
|
||||||
|
width: 70px ;
|
||||||
|
display : inline;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue