Prev Demo
Radial Gradient
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Radial gradient</title> </head> <body> <canvas id="Canvas" width="200" height="200"></canvas> <script> var canvas = document.getElementById('Canvas'); var context = canvas.getContext('2d'); context.rect(0, 0, 600, 250); var radial = context.createRadialGradient(100, 100, 50, 100, 100, 100); radial.addColorStop(1, 'pink'); radial.addColorStop(0, 'yellow'); radial.addColorStop(1, 'green'); context.fillStyle = radial; context.fill(); </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output