ZodiacMysteries
  • Login
Cart / £0.00
No Result
View All Result
  • Home
  • Constellation
    • Aquarius
    • Aries
    • Cancer
    • Capricorn
    • Gemini
    • Leo
    • Libra
    • Pisces
    • Sagittarius
    • Scorpio
    • Taurus
    • Virgo
  • Astrology
  • Shop
    • Checkout
    • Cart
ZodiacMysteries
No Result
View All Result
Custom Constellation Generator: Make Personalized Star Charts.

Custom Constellation Generator: Make Personalized Star Charts.

by Dream
2025-02-17
in Constellation
Share on FacebookShare on Twitter

Okay, here’s my blog post about making a constellation generator, written in the style you requested:

So, I got this kinda random idea the other day – I wanted to make my own constellations! I’m no artist, so drawing them was out. I figured, “Hey, I can code, I can make something that spits out random star patterns!”

First thing I did was just mess around. I needed a way to, you know, show the stars. I thought about using a simple HTML canvas because I wanted to do somthing in browser. I thought, okay, I can use javascript, and that’s it. That felt like the easiest way to get something on the screen without pulling in a ton of other stuff.

Getting the Basics Down

I started with a super basic HTML file. It just had a canvas element, and some width and height. Pretty standard, nothing fancy.

Then came the JavaScript. I needed a way to make random dots. The fillRect method on the canvas context was perfect for this. I whipped up a little loop, and inside that, I used to get random X and Y positions for each “star.”


<canvas id="myCanvas" width="500" height="500"></canvas>

Custom Constellation Generator: Make Personalized Star Charts.

<script>

var canvas = *('myCanvas');

var ctx = *('2d');

for (let i = 0; i < 50; i++) {

var x = *() *;

var y = *() *;

* = 'white';

*(x, y, 2, 2);

Custom Constellation Generator: Make Personalized Star Charts.

</script>

Boom! I had a screen full of white dots on a black background. It looked…okay. A bit too random, though. Real constellations have, like, patterns, right?

Making it More “Constellation-y”

I spent a while just staring at my random dots, trying to figure out how to make them look less random,and more constellation-y. My first thought? Some stars are brighter than others. So, I played around with the size of the dots. Instead of all of them being 2×2 pixels, I made the size random too. Some tiny, some a bit bigger.


<script>

var canvas = *('myCanvas');

var ctx = *('2d');

* = "black";

*(0, 0, *, *);

Custom Constellation Generator: Make Personalized Star Charts.

for (let i = 0; i < 70; i++) {

var x = *() *;

var y = *() *;

var size = *() 3 + 1;

* = 'white';

*(x, y, size, size);

</script>

And I added more dots. the number of dots is also a key to make it real.

Custom Constellation Generator: Make Personalized Star Charts.

Next, I messed with the color. Instead of pure white, I gave them a slightly off-white, yellowish tint. This made them look a bit more…starlike, I guess.


<script>

var canvas = *('myCanvas');

var ctx = *('2d');

* = "black";

*(0, 0, *, *);

for (let i = 0; i < 70; i++) {

var x = *() *;

Custom Constellation Generator: Make Personalized Star Charts.

var y = *() *;

var size = *() 3 + 1;

* = 'rgb(255, 255, 240)';

*(x, y, size, size);

</script>

I wanted some structure. I decided to group some stars closer together.I achieved it, roughly, by making the random number generation not quite so random. I did some probability magic, it means it’s more likely to pick positions near existing stars.

Finally, I add a simple function to re-generate. Just a button, and when you click it, BAM, new random constellation.


<!DOCTYPE html>

Custom Constellation Generator: Make Personalized Star Charts.

<html>

<head>

<title>Constellation Generator</title>

</head>

<body>

<canvas id="myCanvas" width="500" height="500"></canvas>

<button id="generateBtn">Generate New Constellation</button>

<script>

Custom Constellation Generator: Make Personalized Star Charts.

var canvas = *('myCanvas');

var ctx = *('2d');

var generateBtn = *('generateBtn');

function generateConstellation() {

* = "black";

*(0, 0, *, *);

for (let i = 0; i < 70; i++) {

var x = *() *;

Custom Constellation Generator: Make Personalized Star Charts.

var y = *() *;

var size = *() 3 + 1;

* = 'rgb(255, 255, 220)';

*(x, y, size, size);

generateConstellation();

*('click', generateConstellation);

</script>

</body>

Custom Constellation Generator: Make Personalized Star Charts.

</html>

Wrapping Up

It’s still pretty basic, and I didn’t spend too much time for it. I bet I could spend days tweaking the randomness to make it look even better. Maybe add some lines connecting the stars, or even make them twinkle! But for a quick, fun little project, I’m pretty happy with how it turned out. It definitely scratched that itch to make my own star patterns.

Dream

Dream

Related Posts

aquarius remigis
Aquarius

aquarius remigis

2025-02-21

So, I’ve been messing around with this “aquarius remigis” thing, and let me tell you, it’s been a journey. I...

Savage Female Capricorn Quotes: Real Talk & Zodiac Inspiration for the Capricorn Woman.
Capricorn

Savage Female Capricorn Quotes: Real Talk & Zodiac Inspiration for the Capricorn Woman.

2025-02-21

Okay, here’s my blog post about “savage female Capricorn quotes,” written in the style you requested: Alright, so I got...

Cancer Sun Aries Moon Virgo Rising Deep Dive: Get to Know Your Astrological Self.
Cancer

Cancer Sun Aries Moon Virgo Rising Deep Dive: Get to Know Your Astrological Self.

2025-02-21

Okay, here’s my blog post about “cancer sun aries moon virgo rising”, written from a personal practice perspective, focusing on...

Sagittarius Lucky Numbers Today and Tomorrow: Your Daily Guide!
Sagittarius

Sagittarius Lucky Numbers Today and Tomorrow: Your Daily Guide!

2025-02-21

Okay, so the other day I was feeling a bit blah, you know, just one of those days where you...

Sagittarius Lucky Pick 3 Numbers Today: Daily Forecast Tips!
Sagittarius

Sagittarius Lucky Pick 3 Numbers Today: Daily Forecast Tips!

2025-02-21

Okay, so today I decided to try my luck with the “Sagittarius lucky pick 3 numbers” thing. I’ve seen it...

Today & Tomorrows Lucky Pick 3 Numbers for Sagittarius (Easy Tips)
Sagittarius

Today & Tomorrows Lucky Pick 3 Numbers for Sagittarius (Easy Tips)

2025-02-21

Okay, so I’ve been messing around with this whole “lucky numbers” thing, specifically for Sagittarius, because, why not? I’m a...

Next Post
Are You a Sagittarius? See The Famous Musicians with The Same Zodiac Sign!

Are You a Sagittarius? See The Famous Musicians with The Same Zodiac Sign!

aquarius as a mother

aquarius as a mother

Lucky No For Capricorn Today? Discover Your Daily Fortune Predictor Now!

Lucky No For Capricorn Today? Discover Your Daily Fortune Predictor Now!

ZodiacMysteries

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Check our landing page for details.

Read more

    Go to the Customizer > JNews : Social, Like & View > Instagram Feed Setting, to connect your Instagram account.
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2024 ZodiacMysteries - Astrology Insights& sitemap.

No Result
View All Result
  • Home
  • Constellation
    • Aquarius
    • Aries
    • Cancer
    • Capricorn
    • Gemini
    • Leo
    • Libra
    • Pisces
    • Sagittarius
    • Scorpio
    • Taurus
    • Virgo
  • Astrology
  • Shop
    • Checkout
    • Cart

© 2024 ZodiacMysteries - Astrology Insights& sitemap.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In