Author Topic: Easter Egg Decorating  (Read 19857 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Easter Egg Decorating
« Reply #30 on: April 01, 2022, 11:37:54 am »
Holy crap, vince and dbox win. Bro, lemme make that link bigger:

...

They haven't gotten to decorating yet and STx is already voting!

Who cares about colors it's all about the math! LOL

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #31 on: April 01, 2022, 12:34:00 pm »
That's neat Steve but there's no egg anywhere on the screen. The Matrix letters just fall everywhere.

Vince that's really cool! I started to attempt something like that yesterday but I think I had a problem with the square root of a negative number and I just wasn't figuring out the math good enough.
DBox, I get an Illegal String Conversion error on Line 42.
Code: QB64: [Select]
  1.  Dim c: c = DomCreate("div")
  2.  


Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: Easter Egg Decorating
« Reply #32 on: April 01, 2022, 12:38:01 pm »
They haven't gotten to decorating yet and STx is already voting!

Who cares about colors it's all about the math! LOL

Updated with maths AND colors: View in QBJS

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: Easter Egg Decorating
« Reply #33 on: April 01, 2022, 12:40:14 pm »
That's neat Steve but there's no egg anywhere on the screen. The Matrix letters just fall everywhere.

Vince that's really cool! I started to attempt something like that yesterday but I think I had a problem with the square root of a negative number and I just wasn't figuring out the math good enough.
DBox, I get an Illegal String Conversion error on Line 42.
Code: QB64: [Select]
  1.  Dim c: c = DomCreate("div")
  2.  


Hey @SierraKen, is there more to that program?  I don't see any errors when I run just that line in a new QBJS window.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #34 on: April 01, 2022, 12:45:56 pm »
DBox, I ran it  on QB64, I don't have QBJS.

Offline dbox

  • Newbie
  • Posts: 80
    • View Profile
Re: Easter Egg Decorating
« Reply #35 on: April 01, 2022, 01:05:51 pm »
DBox, I ran it  on QB64, I don't have QBJS.

Oh, I see.  Yes, I'm afraid that example won't run in QB64 since it uses web controls.  QBJS is just a web page, you don't actually have to have anything installed you can view and run the code by just Clicking this link

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Easter Egg Decorating
« Reply #36 on: April 01, 2022, 01:07:37 pm »
OK!

 
image_2022-04-01_130729.png

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #37 on: April 01, 2022, 01:13:36 pm »
That's neat Steve but there's no egg anywhere on the screen. The Matrix letters just fall everywhere.

They're not falling inside the egg for you?   Shouldn't you be seeing something like this:

 
Steve Egg.png


Here, I've painted the egg itself BLACK, so that the green matrix letters show up better on it and are easier to see as they move and rain down across the surface of the egg.   Are you not getting this effect somehow?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #38 on: April 01, 2022, 01:25:26 pm »
Oh that is awesome DBox! I had no idea that existed. Pretty cool egg maker too!
B+, I had a feeling you were going to go wild on us.. LOLOL, awesome.
Steve, no it doesn't show the egg, I have the .png in the same folder too. But that looks awesome!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #39 on: April 01, 2022, 01:26:01 pm »
Maybe it'll look a little more egglike for you, if I use a different color scheme?

Code: QB64: [Select]
  1. WorkScreen = _NewImage(800, 800, 32)
  2. DisplayScreen = _NewImage(800, 800, 32)
  3. egg = _LoadImage("egg.png", 32)
  4. font = _LoadFont("courbd.ttf", 36, "monospace")
  5. Screen DisplayScreen
  6.  
  7.  
  8.  
  9. For i = 1 To UBound(m)
  10.     m(i) = -Int(Rnd * _Height)
  11.  
  12. _Dest WorkScreen
  13. _Font font
  14.  
  15.  
  16.     _Dest WorkScreen
  17.  
  18.     Line (0, 0)-(_Width, _Height), &H20D2B48C, BF '_RGBA32(0, 0, 0, 20), BF
  19.  
  20.     For i = 1 To UBound(m)
  21.         Color _RGB32(0, 255, 0), 0
  22.         m(i) = m(i) + _FontHeight
  23.         If m(i) > 0 Then
  24.             If m(i) > _Height Then m(i) = -Int(Rnd * _Height)
  25.             _PrintString (i * _FontWidth - _FontWidth, m(i)), Chr$(_Ceil(Rnd * 254))
  26.         End If
  27.     Next
  28.  
  29.     For y = 0 To _Height(egg) - 1
  30.         For x = 0 To _Width(egg) - 1
  31.             _Source egg
  32.  
  33.             p&& = _Alpha(Point(x, y))
  34.  
  35.             _Source WorkScreen
  36.             If p&& > 200 Then
  37.                 p&& = Point(x, y)
  38.                 _Dest DisplayScreen
  39.                 PSet (x, y), p&&
  40.             End If
  41.         Next
  42.     Next
  43.     _Display
  44.  

 
Steve Egg.png


Does this make it a little more obvious that the letters are raining down across the eggshell?  Or should I just toss the matrix rain idea and see if something like flickering flames might look better for an animated egg paint?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #40 on: April 01, 2022, 01:29:10 pm »
Steve, no it doesn't show the egg, I have the .png in the same folder too. But that looks awesome!

Windows machine?  Let's rule out something simple like a upper/lowercase situation with Linux filenames and such to begin with.  I'm curious why the heck you're not seeing the same effect that I am with the code.  Latest version of QB64 too, I take it? 

Umm...

(Starts digging into the code to see where the heck the overlays might be messing up on different systems...)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #41 on: April 01, 2022, 01:29:24 pm »
Steve I found the problem, I accidentally didn't copy/paste the first line WorkScreen = _NewImage(800, 800, 32)   
LOL DOH.
I'll try your other one now.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Easter Egg Decorating
« Reply #42 on: April 01, 2022, 01:34:15 pm »
Steve I found the problem, I accidentally didn't copy/paste the first line WorkScreen = _NewImage(800, 800, 32)   
LOL DOH.
I'll try your other one now.

LOL!  Had me all worried that there was something majorly off in the code.  Unfortunately, I'm now going to have to add your name to my EVIL CODER list, right below Pete's entry!  I was trying to sip on my coffee when I read your response, and you made me chuckle so badly that I snorted hot coffee out my nose!

If *that* doesn't qualify someone to be listed as an EVIL CODER, then I don't know what does!  :P
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Easter Egg Decorating
« Reply #43 on: April 01, 2022, 01:40:24 pm »
ROFL.... you might chuckle even more to find out that I'm a preacher at my Christian church. :)

Your other one is awesome! I might have to use your Matrix code on stuff sometimes.

Offline CharlieJV

  • Newbie
  • Posts: 89
    • View Profile
Re: Easter Egg Decorating
« Reply #44 on: April 01, 2022, 06:26:36 pm »