PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Fri Aug 26, 2005 7:05 am
T h i s i s t e x t i n a p r e t t y r a i n b o w s t y l e e . A w w . . s o p w e e t t y !
Code: Select all
<?php
$string = "This is text in a pretty rainbow stylee. Aww.. so pweetty!";
$steps = strlen($string);
$r = 255; $g = 0; $b = 255;
$step = 255 / ceil($steps/5);
for ($x=0;$x<$steps;$x++) {
if ($x%ceil($steps/5) == 0) { $s++; }
switch ($s) {
case 1: $b -= $step; break;
case 2: $g += $step; break;
case 3: $r -= $step; break;
case 4: $b += $step; break;
case 5: $g -= $step; break;
}
echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}."[/color]";
}
?>
Don't ask why I wrote this..
Ree
Forum Regular
Posts: 592 Joined: Fri Jun 10, 2005 1:43 am
Location: LT
Post
by Ree » Fri Aug 26, 2005 7:13 am
Why did you write this?
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098 Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia
Post
by Chris Corbyn » Fri Aug 26, 2005 7:20 am
Ree wrote: Why did you write this?
Because it's cool and I'm guessing he was a lil' bit bored
I do funky stuff like that when I get bored... sometimes it inspires me to carry it further
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Fri Aug 26, 2005 7:29 am
onion needs a new project! (or a vacation)
onion2k
Jedi Mod
Posts: 5263 Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com
Post
by onion2k » Fri Aug 26, 2005 8:01 am
Ree wrote: Why did you write this?
I said don't ask. Now I have to kill you.
Actually, it was because someone on a different forum posted to say people posting in different colours annoyed him.
EDIT: And, rather brilliantly, that post was the one that carried me over into Master status.
Roja
Tutorials Group
Posts: 2692 Joined: Sun Jan 04, 2004 10:30 pm
Post
by Roja » Fri Aug 26, 2005 8:46 am
onion2k wrote: Actually, it was because someone on a different forum posted to say people posting in different colours annoyed him.
That person is not alone.
Now I'm tempted to write a preference addon for PHPBB that will allow users to ignore color changes..
Its an arms race of annoyance, I tell ya.
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Fri Aug 26, 2005 10:05 am
Onion2k, once again you amaze me with your brilliant experimentations
Keep it up
The Monkey
Forum Contributor
Posts: 168 Joined: Tue Mar 09, 2004 9:05 am
Location: Arkansas, USA
Post
by The Monkey » Fri Aug 26, 2005 11:13 am
Coolness.
nielsene
DevNet Resident
Posts: 1834 Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA
Post
by nielsene » Fri Aug 26, 2005 11:17 am
While I don't mind the colorful text, the markup is highly offensive... look... multipled the string length by about 35.... ick... (Cool effect though
)
Code: Select all
<span style="color: #FF00E9">T</span><span style="color: #FF00D4">h</span><span style="color: #FF00BF">i</span><span style="color: #FF00AA">s</span><span style="color: #FF0094"> </span><span style="color: #FF007F">i</span><span style="color: #FF006A">s</span><span style="color: #FF0055"> </span><span style="color: #FF003F">t</span><span style="color: #FF002A">e</span><span style="color: #FF0015">x</span><span style="color: #FF0000">t</span><span style="color: #FF1500"> </span><span style="color: #FF2A00">i</span><span style="color: #FF3F00">n</span><span style="color: #FF5500"> </span><span style="color: #FF6A00">a</span><span style="color: #FF7F00"> </span><span style="color: #FF9400">p</span><span style="color: #FFAA00">r</span><span style="color: #FFBF00">e</span><span style="color: #FFD400">t</span><span style="color: #FFE900">t</span><span style="color: #FFFF00">y</span><span style="color: #E9FF00"> </span><span style="color: #D4FF00">r</span><span style="color: #BFFF00">a</span><span style="color: #AAFF00">i</span><span style="color: #94FF00">n</span><span style="color: #7FFF00">b</span><span style="color: #6AFF00">o</span><span style="color: #55FF00">w</span><span style="color: #3FFF00"> </span><span style="color: #2AFF00">s</span><span style="color: #15FF00">t</span><span style="color: #00FF00">y</span><span style="color: #00FF15">l</span><span style="color: #00FF2A">e</span><span style="color: #00FF3F">e</span><span style="color: #00FF55">.</span><span style="color: #00FF6A"> </span><span style="color: #00FF7F">A</span><span style="color: #00FF94">w</span><span style="color: #00FFAA">w</span><span style="color: #00FFBF">.</span><span style="color: #00FFD4">.</span><span style="color: #00FFE9"> </span><span style="color: #00FFFF">s</span><span style="color: #00E9FF">o</span><span style="color: #00D4FF"> </span><span style="color: #00BFFF">p</span><span style="color: #00AAFF">w</span><span style="color: #0094FF">e</span><span style="color: #007FFF">e</span><span style="color: #006AFF">t</span><span style="color: #0055FF">t</span><span style="color: #003FFF">y</span><span style="color: #002AFF">!</span>
wwwapu
Forum Contributor
Posts: 197 Joined: Wed Apr 07, 2004 11:57 am
Location: Turku, Finland
Post
by wwwapu » Fri Aug 26, 2005 12:57 pm
It would be perfect if you added a feature that made background like rainbow too. Possibly with many tiny divs and text floating on top of them?
How annoying would that be?
pilau
Forum Regular
Posts: 594 Joined: Sat Jul 09, 2005 10:22 am
Location: Israel
Post
by pilau » Fri Sep 30, 2005 10:45 am
wwwapu wrote: It would be perfect if you added a feature that made background like rainbow too. Possibly with many tiny divs and text floating on top of them?
How annoying would that be?
Very much annoying!
Afterlife(69)
Spammer :|
Posts: 14 Joined: Mon Oct 03, 2005 4:51 am
Post
by Afterlife(69) » Mon Oct 03, 2005 4:53 am
Nice
heres a lil UI for it.
Code: Select all
<center>
<?php
if(!empty($HTTP_POST_VARS['textbox']))
{
$string = $HTTP_POST_VARS['textbox'];
$steps = strlen($string);
$r = 255; $g = 0; $b = 255;
$step = 255 / ceil($steps/5);
echo '<textarea rows="15" name="output" cols="45" style="width:100%">';
for ($x=0;$x<$steps;$x++)
{
if ($x%ceil($steps/5) == 0)
{
$s++;
}
switch ($s)
{
case 1: $b -= $step; break;
case 2: $g += $step; break;
case 3: $r -= $step; break;
case 4: $b += $step; break;
case 5: $g -= $step; break;
}
echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}."[/color]";
}
echo '</textarea><br />';
}
?>
<form method="POST" action="<?php echo basename(__FILE__); ?>">
<textarea rows="15" name="textbox" cols="45"></textarea><br />
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</center>
Luke
The Ninja Space Mod
Posts: 6424 Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA
Post
by Luke » Wed Oct 05, 2005 4:18 pm
W o w . . . t h a t i s a n n o y i n g .
Dm7
Forum Commoner
Posts: 67 Joined: Sat Oct 08, 2005 9:16 pm
Location: USA
Post
by Dm7 » Sat Nov 05, 2005 7:10 pm
W o w t h a t ' s s o b e a u t i f u l . . . : P
LOL I love that code snippet. XD I don't know how you do that... I'm curious where/how you learned about that?