Skip to content

Instantly share code, notes, and snippets.

@marioluan
Last active December 16, 2015 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marioluan/5500217 to your computer and use it in GitHub Desktop.
Save marioluan/5500217 to your computer and use it in GitHub Desktop.
Lista de classes de figuras geométricas utilizando javascript, html e css.
function Circle(width, height, color){
/*
** @param {Integer} largura
** @param {Integer} altura
** @param {String} cor
*/
this.width = width || 100;
this.height = height || 100;
this.color = color || 'red';
this.setAttribute = function(attribute){
this[attribute] = attribute;
}
this.getAttribute = function(attribute){
return this[attribute];
}
this.draw = function(){
var el = document.createElement('div');
el.style.width = this.width;
el.style.height = this.height;
el.style.background = this.color;
el.style.position = 'absolute';
el.style.borderRadius = '50%';
return el;
}
}
function Olho(){
this.piscar = function(){
this.
};
}
// instanciando o circulo e adicionando na tela
var circle = new Circle();
document.body.appendChild(circle.draw());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment