Komaqtion
You can change this now in User CP.
- Reaction score
- 469
Oh, ok XD
Well, this is what I have now, and it isn't working...
I saw that I can't use [ljass]set this.alpha = this.alpha + this.increment[/ljass] and [ljass]call ModifyUnitVertexColor( this.u, 255, 255, 255, R2I( this.alpha ) )[/ljass] since Appearance[ this.u ].alpha became like 6000.0 big ! XD
Or, did I do something wrong now ? :S
Well, this is what I have now, and it isn't working...
JASS:
library ScaleAndFade requires KT, ModifyAppearance
globals
private constant real PERIOD = 0.03125
endglobals
struct SmoothScale
private unit u
private real scale
private real endScale
private real increment
//private code userFunc
private static method periodic takes nothing returns boolean
local SmoothScale this = KT_GetData()
//set this.scale = this.scale + this.increment
if ( this.scale > this.endScale and this.increment > 0 ) or ( this.scale < this.endScale and this.increment < 0 ) then
call this.destroy()
//call this.userFunc.execute()
return true
endif
call ModifyUnitScale( this.u, this.increment )
debug call BJDebugMsg( R2S( this.scale ) )
return false
endmethod
static method create takes unit Scaler, real startScale, real endScale, real Time, real Period, code userFunc returns thistype
local thistype this = thistype.allocate()
local real period
if Period > 0 then
set period = Period
else
set period = PERIOD
endif
set this.u = Scaler
set this.scale = startScale
set this.endScale = endScale
//set this.userFunc = userFunc
set this.increment = ( ( ( endScale - startScale ) * period ) / Time )
call KT_Add( function thistype.periodic, this, period )
return this
endmethod
endstruct
function ScaleSimple takes unit Scaler, real startScale, real endScale, real Time returns SmoothScale
return SmoothScale.create( Scaler, startScale, endScale, Time, 0., null )
endfunction
function ScaleSimplePeriod takes unit Scaler, real startScale, real endScale, real Time, real Period, code userFunc returns SmoothScale
return SmoothScale.create( Scaler, startScale, endScale, Time, Period, null )
endfunction
function ScaleEx takes unit Scaler, real startScale, real endScale, real Time, real Period, code userFunc returns SmoothScale
return SmoothScale.create( Scaler, startScale, endScale, Time, 0., userFunc )
endfunction
function ScaleExPeriod takes unit Scaler, real startScale, real endScale, real Time, real Period, code userFunc returns SmoothScale
return SmoothScale.create( Scaler, startScale, endScale, Time, Period, userFunc )
endfunction
struct SmoothFade
private real rincrement
private real gincrement
private real bincrement
private real alpha
private real increment
private real endAlpha
private unit u
private static method periodic takes nothing returns boolean
local SmoothFade this = KT_GetData()
//set this.alpha = this.alpha + this.increment
if ( this.alpha > this.endAlpha and this.increment > 0 ) or ( this.alpha < this.endAlpha and this.increment < 0 ) then
call this.destroy()
return true
endif
if this.rincrement == 0 and this.gincrement == 0 and this.bincrement == 0 then
call ModifyUnitVertexColor( this.u, 255, 255, 255, R2I( this.increment ) )
else
call ModifyUnitVertexColor( this.u, R2I( this.rincrement ), R2I( this.gincrement ), R2I( this.bincrement ), R2I( this.increment ) )
endif
debug call BJDebugMsg( R2S( Appearance[ this.u ].alpha ) )
return false
endmethod
static method create takes unit Fader, boolean StaticRGB, real startAlpha, real endAlpha, real Time, real Period, real startRed, real startGreen, real startBlue, real endRed, real endGreen, real endBlue returns thistype
local thistype this = thistype.allocate()
local real period
if Period > 0 then
set period = Period
else
set period = PERIOD
endif
set this.u = Fader
set this.alpha = startAlpha
set this.endAlpha = endAlpha
set this.increment = ( ( ( endAlpha - startAlpha ) * period ) / Time )
if StaticRGB != true then
set this.rincrement = ( ( ( endRed - startRed ) * period ) / Time )
set this.gincrement = ( ( ( endGreen - startGreen ) * period ) / Time )
set this.bincrement = ( ( ( endBlue - startBlue ) * period ) / Time )
endif
call KT_Add( function thistype.periodic, this, period )
return this
endmethod
endstruct
function FadeSimple takes unit Fader, real startAlpha, real endAlpha, real Time returns SmoothFade
return SmoothFade.create( Fader, true, startAlpha, endAlpha, Time, 0., 255., 255., 255., 255., 255., 255. )
endfunction
function FadeSimplePeriod takes unit Fader, real startAlpha, real endAlpha, real Time, real Period returns SmoothFade
return SmoothFade.create( Fader, true, startAlpha, endAlpha, Time, Period, 255., 255., 255., 255., 255., 255. )
endfunction
function FadeEx takes unit Fader, real startAlpha, real endAlpha, real Time, real startRed, real startGreen, real startBlue, real endRed, real endGreen, real endBlue returns SmoothFade
return SmoothFade.create( Fader, false, startAlpha, endAlpha, Time, 0., startRed, startGreen, startBlue, endRed, endGreen, endBlue )
endfunction
function FadeExStatic takes unit Fader, real startAlpha, real endAlpha, real Time, real startRed, real startGreen, real startBlue, real endRed, real endGreen, real endBlue returns SmoothFade
return SmoothFade.create( Fader, true, startAlpha, endAlpha, Time, 0., startRed, startGreen, startBlue, endRed, endGreen, endBlue )
endfunction
function FadeExPeriod takes unit Fader, real startAlpha, real endAlpha, real Time, real Period, real startRed, real startGreen, real startBlue, real endRed, real endGreen, real endBlue returns SmoothFade
return SmoothFade.create( Fader, true, startAlpha, endAlpha, Time, Period, startRed, startGreen, startBlue, endRed, endGreen, endBlue )
endfunction
function FadeExPeriodStatic takes unit Fader, real startAlpha, real endAlpha, real Time, real Period, real startRed, real startGreen, real startBlue, real endRed, real endGreen, real endBlue returns SmoothFade
return SmoothFade.create( Fader, false, startAlpha, endAlpha, Time, Period, startRed, startGreen, startBlue, endRed, endGreen, endBlue )
endfunction
endlibrary
I saw that I can't use [ljass]set this.alpha = this.alpha + this.increment[/ljass] and [ljass]call ModifyUnitVertexColor( this.u, 255, 255, 255, R2I( this.alpha ) )[/ljass] since Appearance[ this.u ].alpha became like 6000.0 big ! XD
Or, did I do something wrong now ? :S