Tutorial by Examples: angles

You can use the clearRect method to clear any rectangular section of the canvas. // Clear the entire canvas ctx.clearRect(0, 0, canvas.width, canvas.height); Note: clearRect is dependent on the transformation matrix. To deal with this, it's possible to reset the transformation matrix befor...
To create a CSS triangle define an element with a width and height of 0 pixels. The triangle shape will be formed using border properties. For an element with 0 height and width the 4 borders (top, right, bottom, left) each form a triangle. Here's an element with 0 height/width and 4 different color...
Corner radius for all 4 edges: UIBezierPath* rectanglePath = [UIBezierPath bezierPathWithRoundedRect: CGRectMake(x,y,width,height) cornerRadius: 11]; [UIColor.grayColor setFill]; [rectanglePath fill]; Corner radius for top-left edge: UIBezierPath* rectanglePath = [UIBezierPath bezierPat...
// rectangle objects { x:, y:, width:, height: } // return true if the 2 rectangles are colliding // r1 and r2 are rectangles as defined above function RectsColliding(r1,r2){ return !( r1.x>r2.x+r2.width || r1.x+r1.width<r2.x || r1.y>r2.y+r2.height || ...
What is a "Shape"? You typically save your shapes by creating a JavaScript "shape" object representing each shape. var myCircle = { x:30, y:20, radius:15 }; Of course, you're not really saving shapes. Instead, you're saving the definition of how to draw the shapes. Then put...
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Draw two rectangles on the canvas</title> <style> canvas{ border:1px solid gray; } </style> <script async...

Page 1 of 1