Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Text Effect


  • Please log in to reply
16 replies to this topic

#1 Jex

Jex

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 05 December 2007 - 11:06 AM

Creating text effect...

AutoIt         
#include <GUIConstants.au3> #include <Color.au3> Opt("GUIOnEventMode", 1) $Width = 550 $Height = 500 $Form = GUICreate("Text Effect", $Width, $Height, -1, -1) GUISetBkColor(0x666666) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") TextEffect("Text Effect !", 15, 300, 50, 40, 10, 20, 0x000000, 0x00FF00, 25, 25, 1, 1) TextEffect("Text Effect !", 35, 200, 50, 40, 10, 20, 0x000000, 0xFF0000, 25, 25, 1, 1) TextEffect("Text Effect !", 55, 100, 50, 40, 10, 20, 0x000000, 0x0000FF, 25, 25, 1, 1) While 1     Sleep(100) WEnd Func TextEffect($Text, $Left, $Top, $Fontsize, $Fontspace, $Step, $Delay, $Color, $Color2, $Colorstep, $Colorstep2, $Shadow, $Gradient)     $Color = Colors($Color, $Color2, $Colorstep, $Colorstep2)     $Letters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9"     $Let = StringSplit($Letters, ",", 1)     $Len = StringLen($Text)     Local $Control[$Len + 1], $Fontspace2 = 0     For $i = 1 To $Len         $pLeft = (($Left + ($i * $Fontspace)) - $Fontspace2) - $Fontspace         $Control[$i] = GUICtrlCreateLabel("", $pLeft, 0, $Fontspace, $Fontspace * 2)         GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)         GUICtrlSetFont(-1, $Fontsize)         $sLeft = StringLeft($Text, $i)         If $i <> 1 Then $sLeft = StringTrimLeft($sLeft, $i - 1)         If $sLeft <> " "  Then             For $z = 1 To $Step                 GUICtrlSetPos(-1, $pLeft, $z * ($Top / $Step))                 $Text2 = $Let[Random(1, UBound($Let) - 1, 1)]                 GUICtrlSetData(-1, $Text2)                 GUICtrlSetColor(-1, $Color[$z * ($Colorstep / $Step)])                 Sleep($Delay)             Next         EndIf         GUICtrlSetData(-1, $sLeft)         If $Gradient = 1 Then             If $i < $Len / 2 Then                 GUICtrlSetColor(-1, $Color[$Colorstep - ($i * (($Colorstep / 2) / ($Len / 2)))])             Else                 GUICtrlSetColor(-1, $Color[($Colorstep / 2) + (($i - ($Len / 2)) * (($Colorstep / 2) / ($Len / 2)))])             EndIf         EndIf         If $Shadow = 1 Then             GUICtrlCreateLabel($sLeft, $pLeft - 3, $Top + 3, $Fontspace, $Fontspace * 2)             GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)             GUICtrlSetColor(-1, $Color[$Step / 1.2])             GUICtrlSetFont(-1, $Fontsize)             GUICtrlSetPos($Control[$i], $pLeft, $Top)         EndIf         If $sLeft = "i"  Or $sLeft = "ı"  Then $Fontspace2 += $Fontspace / 2         If $sLeft = "f"  Or $sLeft = "l"  Then $Fontspace2 += $Fontspace / 2.5     Next EndFunc   ;==>TextEffect Func Colors($nStartColor = 0x00FF00, $nEndColor = 0x000000, $Step = 50, $Step2 = 50)     Local $color1R = _ColorGetRed($nStartColor)     Local $color1G = _ColorGetGreen($nStartColor)     Local $color1B = _ColorGetBlue($nStartColor)     Local $nStepR = (_ColorGetRed($nEndColor) - $color1R) / $Step2     Local $nStepG = (_ColorGetGreen($nEndColor) - $color1G) / $Step2     Local $nStepB = (_ColorGetBlue($nEndColor) - $color1B) / $Step2     For $i = 1 To $Step         $sColor = "0x" & StringFormat("%02X%02X%02X", $color1R + $nStepR * $i, $color1G + $nStepG * $i, $color1B + $nStepB * $i)         If $i = 1 Then             $Colors = $sColor         Else             $Colors &= "," & $sColor         EndIf     Next     $Colors = StringSplit($Colors, ",", 1)     Return $Colors EndFunc   ;==>Colors Func Quit()     DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 500, "long", 0x00090000)     Exit EndFunc   ;==>Quit


Edit : Added Gradient & Shadow.

Edited by Jex, 06 December 2007 - 10:26 AM.








#2 Draygoes

Draygoes

    Because yes!

  • Active Members
  • PipPipPipPipPipPip
  • 3,332 posts

Posted 05 December 2007 - 11:51 AM

Looks good!!! :)

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist.
A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

#3 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 05 December 2007 - 02:07 PM

Nice! Maybe add:
While 1  Sleep(100) WEnd

It was fine till the action stopped then it would spike up in the task manager to 25% CPU usage... :)

#4 Jex

Jex

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 05 December 2007 - 02:18 PM

Nice! Maybe add:

While 1  Sleep(100) WEnd

It was fine till the action stopped then it would spike up in the task manager to 25% CPU usage... :)

I'm not noticed CPU usage thanks ^_^ I'm didn't think empty while/wend loop will use like that much CPU :)

Edited by Jex, 05 December 2007 - 02:22 PM.


#5 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 05 December 2007 - 09:23 PM

Yeah, that seems to make the CPU Think real hard :) LOL

#6 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 05 December 2007 - 10:31 PM

Cool!

8)

Posted Image

Clic The Pic!!!


#7 Nahuel

Nahuel

    To Err is human, to Arr is pirate.

  • Active Members
  • PipPipPipPipPipPip
  • 1,841 posts

Posted 05 December 2007 - 11:09 PM

:) Me likes! One complaint though:
Func Quit()     For $i = 255 To 1 Step - 1         WinSetTrans($Form, "", $i)     Next     Exit EndFunc  ;==>Quit

That's TERRIBLY slow!! Check THIS out:


Func Quit()     DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 200, "long", 0x00090000)     Exit EndFunc  ;==>Quit


^_^

#8 JustinReno

JustinReno

    My custom made Vortex.

  • Banned (NOT IN USE)
  • 2,330 posts

Posted 06 December 2007 - 01:04 AM

This is really nice, pretty creative too. Good job! :)

#9 Jex

Jex

    Polymath

  • Active Members
  • PipPipPipPip
  • 206 posts

Posted 06 December 2007 - 10:24 AM

:) Me likes! One complaint though:

Func Quit()     For $i = 255 To 1 Step - 1         WinSetTrans($Form, "", $i)     Next     Exit EndFunc ;==>Quit

That's TERRIBLY slow!! Check THIS out:


Func Quit()     DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $Form, "int", 200, "long", 0x00090000)     Exit EndFunc ;==>Quit


:)

Nearly instantly happen for..next method in my pc for that reason i'm not think that will be very slow in other pc's.
I'm added your DllCall thanks ^_^

#10 SxyfrG

SxyfrG

    Adventurer

  • Active Members
  • PipPip
  • 129 posts

Posted 21 February 2008 - 07:44 AM

That's soooo awesome :)

Too bad when you change the text you want to animate, it doesn't work 100% correctly (overlapping characters &/or overlapping colours)

I'd love to see this fixed up and made into a misc. UDF :)
My scripts:AppLauncherTRAY - Awesome app launcher that runs from the system tray NEW VERSION! | Run Length Encoding - VERY simple compression in pure autoit | Simple Minesweeper Game - Fun little game :)My website

#11 Haseeb

Haseeb

    Seeker

  • Banned (NOT IN USE)
  • 28 posts

Posted 28 May 2008 - 09:48 AM

it gives error in 23 line

Resolve it.... or update to new version of autoit.

#12 GHOSTSKIKDA

GHOSTSKIKDA

    Wayfarer

  • Active Members
  • Pip
  • 64 posts

Posted 28 May 2008 - 11:56 AM

Thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu!!!!!!!!!

I LOVE ALGERIA .... ;-)


#13 ResNullius

ResNullius

    Drink Deep, or Taste Not the Pierian Spring

  • Active Members
  • PipPipPipPipPipPip
  • 1,037 posts

Posted 28 May 2008 - 03:14 PM

it gives error in 23 line

Resolve it.... or update to new version of autoit.

It's a simple line wrap error copying from the code box. Just backspace line 24 up until it appends to the end of line 23.
Works perfectly!

#14 Mojo

Mojo

    Wayfarer

  • Active Members
  • Pip
  • 89 posts

Posted 28 May 2008 - 04:20 PM

Well done! Great Effect! Thank you for sharing it :)
You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/

#15 ChromeFan

ChromeFan

    Universalist

  • Banned (NOT IN USE)
  • 280 posts

Posted 07 September 2008 - 08:58 PM

D:\Autoit\text effect.au3 (23) : ==> Unterminated string.:
$Letters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v



>Exit code: 1 Time: 0.797

---------

fix the error
Posted ImageWebsite: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel

#16 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 07 September 2008 - 10:51 PM

The code is correct. The code box shows a return after the "v" as you posted above.

.... a simple press of the delete key will remove the return and bring the next line up.

then it works fine

8)

Posted Image

Clic The Pic!!!


#17 enaiman

enaiman

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,922 posts

Posted 08 September 2008 - 04:43 AM

D:\Autoit\text effect.au3 (23) : ==> Unterminated string.:
$Letters = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v




>Exit code: 1 Time: 0.797

---------

fix the error


You didn't bother to look just 2 posts back - ResNullius gave the answer there. ;)

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users