// Get the canvas element and its context
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
// Define the zodiac signs and their symbols
var signs = [
{name: "Aries", symbol: "♈︎"},
{name: "Taurus", symbol: "♉︎"},
{name: "Gemini", symbol: "♊︎"},
{name: "Cancer", symbol: "♋︎"},
{name: "Leo", symbol: "♌︎"},
{name: "Virgo", symbol: "♍︎"},
{name: "Libra", symbol: "♎︎"},
{name: "Scorpio", symbol: "♏︎"},
{name: "Sagittarius", symbol: "♐︎"},
{name: "Capricorn", symbol: "♑︎"},
{name: "Aquarius", symbol: "♒︎"},
{name: "Pisces", symbol: "♓︎"}
];
// Define some random horoscopes
var horoscopes = [
"You will have a great day today.",
"You will face some challenges, but you will overcome them.",
"You will meet someone new and interesting.",
"You will discover something surprising about yourself.",
"You will have a chance to make a positive change in your life.",
"You will enjoy some quality time with your loved ones.",
"You will learn something new and useful.",
"You will have some fun and excitement.",
"You will feel inspired and creative.",
"You will achieve a goal that you have been working on."
];
// Define the font size and style
var fontSize = 20;
var font = fontSize + "px Arial";
// Define the colors for the text and the background
var textColor = "#ffffff";
var bgColor = "#000000";
// Clear the canvas and fill it with the background color
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = bgColor;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Pick a random sign and horoscope
var signIndex = Math.floor(Math.random() * signs.length);
var sign = signs[signIndex];
var horoscopeIndex = Math.floor(Math.random() * horoscopes.length);
var horoscope = horoscopes[horoscopeIndex];
// Set the text color and font
ctx.fillStyle = textColor;
ctx.font = font;
// Calculate the x and y coordinates for the sign name and symbol
var signNameX = (canvas.width -...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.