This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Draws a smiley inside the given rectangle. The mood value (0...1) is used | |
* to make the smiley happy or sad. | |
* | |
* @param rect Rectangle to draw the smiley into | |
* @param mood Happy (= 1) or sad (= 0) or anything in between | |
*/ | |
-(void)drawSmileyInRect:(CGRect)rect withMood:(float)mood { | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGContextSaveGState(ctx); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An even more common approach to look for vendor specific implementations in | |
* the browsers javascript object model. | |
* lookUpImplementation(vendors,subject,functionName,replacement) is reusable | |
* for other tasks too :-) | |
*/ | |
var vendors = ['webkit','moz','o','ms']; | |
window.requestAnimationFrame = lookUpImplementation( | |
vendors, window, 'requestAnimationFrame' | |
,function(step) { |
NewerOlder