Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
Created February 24, 2009 20:51
Show Gist options
  • Select an option

  • Save subtleGradient/69777 to your computer and use it in GitHub Desktop.

Select an option

Save subtleGradient/69777 to your computer and use it in GitHub Desktop.
Shape.Circle = new Shape({
Extends:Shape,
outline:{
// rules for drawing a circle
}
});
Shape.Rectangle = new Shape({
Extends:Shape,
outline:{
// rules for drawing a box
}
});
Shape.EmailIcon = new Shape({
Extends:Shape,
height:'100%',
width:'100%',
outline:{
// rules for drawing a vector graphic
},
color:green, // the fill color for the shape
box_shadow:[1, 1, black, 'inside']
});
JSS({
'Toolbar':{
Extends:Rectangle,
Implements:KeyboardAccessibleWidget,
background:gradient(blue,green)
},
'Toolbar_Button':{
Extends:Circle,
height:'100%',
width:'100%',
padding:10,
margin:10,
background:gradient(blue,green),
background_fill:stretch,
background_position:[center,center],
box_shadow:[1, 1, black],
hover:{
background_image_opacity:0.5,
background_color:blue
},
active:{
background_image_opacity:1,
background_color:green
}
}
});
var toolbar = new Toolbar();
var submitButton = new Toolbar_Button()
.adopt(new Shape.EmailIcon())
.inject(toolbar)
.addEvents({
'click': function(event){
Email.send();
event.stop();
}
});
toolbar.inject($(document.body)); // injecting a shape into an HTML element creates the canvas and actually does the drawing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment