forked from Leather128/LeatherEngine
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e10da9
commit a40ea1f
Showing
3 changed files
with
29 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,29 @@ | ||
package shaders.custom; | ||
|
||
import flixel.addons.display.FlxRuntimeShader; | ||
import flixel.tweens.FlxEase; | ||
import flixel.tweens.FlxTween; | ||
|
||
/** | ||
* Basically just FlxRuntimeShader but it has tween support | ||
*/ | ||
class CustomShader extends FlxRuntimeShader { | ||
public function update(elapsed:Float) { | ||
// nothing yet | ||
} | ||
/** | ||
* Tweens a shader to a value | ||
* @param property The property to tween | ||
* @param to The value of the property to end up at | ||
* @param duration How long it will take | ||
* @param ease What ease should be used | ||
* @param startDelay The delay to start | ||
* @param onComplete When to do when the tween is done | ||
*/ | ||
public function tween(property:String, to:Float, duration:Float = 1, ease:EaseFunction, ?startDelay:Float = 0.0, ?onComplete:Dynamic){ | ||
FlxTween.num(getFloat(property), to, duration, {ease: ease, onComplete: function(twn) { | ||
if (onComplete != null) | ||
onComplete(); | ||
},startDelay: startDelay,}, (value)->{setFloat(property, value);}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters