
Es posible dibujar curvas Bezier directamente en la página web con instrucciones utilizando el canvas de HTML5 y el método beziercurveTo.
¿para que sirven las curvas de bezier?
Las curvas de bezier sirven para hacer curvas bonitas, de hecho son un método matemático para describir curvas y que ha sido implementado en los sistemas CAD, Photoshop y quien sabe cuanta herramientas más, y,, como pronto se viene el evento de RailsGirls 2.0 hice este post Temático.
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript">
function drawShape(){
// get the canvas element using the DOM
var canvas = document.getElementById('mycanvas');
// Make sure we don't execute when canvas isn't supported
if (canvas.getContext){
// use getContext to use the canvas for drawing
var ctx = canvas.getContext('2d');
ctx.beginPath();
ctx.fillStyle = "rgba(200,0,0,0.5)";
ctx.moveTo(75,40);
ctx.bezierCurveTo(75,37,70,25,50,25);
ctx.bezierCurveTo(20,25,20,62.5,20,62.5);
ctx.bezierCurveTo(20,80,40,102,75,120);
ctx.bezierCurveTo(110,102,130,80,130,62.5);
ctx.bezierCurveTo(130,62.5,130,25,100,25);
ctx.bezierCurveTo(85,25,75,37,75,40);
ctx.fill();
ctx.font = "bold 16px Arial";
ctx.fillText("Rails Girls 2.0", 100, 100);
} else {
alert('Necesitas un navegador moderno para poder ocupar el canvas de Html5 .');
}
}
</script>
</head>
<body onload="drawShape();">
<canvas id="mycanvas"></canvas>
</body>
</html>
¿y no sería lo mismo ocupar una imagen hecha en photoshop?
Claro, de hecho sería mucho más fácil, pero aquí viene el siguiente desafío, ya que el canvas de html5 se puede limpiar cada cierto tiempo como en este experimento, podrías ocupar las curvas de bezier para hacer una animación interesante.
- Yükleme rehberi – Kraken Casino konusunda sık sorulanlar 🛡️ - July 16, 2025
- MostBet Secimleri ile Ugurlu Bahis Stratejileri - July 16, 2025
- Alev Casino ile kazancına ⭐ kazanç kat - July 16, 2025
- Betting Platform by Most Bet: Your Guide to Winning Big - July 16, 2025
- Live tikishlar orqali ko’proq yutuqlar: Mostbet sizga yordam beradi - July 16, 2025
- Alev Turkiye – Canlı Bahis ve Slot Oyunlarında Yuksek Kazanc - July 15, 2025
- Lüks Casino canlı casino keyfini cebine getiriyor 💥 - July 15, 2025
- Harness the Potential of Online Betting with Our Step-by-Step Guide to Mostbet - July 15, 2025
- Mostbet Sitio Oficial: Donde Comienza la Diversion - July 15, 2025
- Discover Top Betting Opportunities with MostBet - July 15, 2025